Forums / Setup & design / Customizing edit template... in a strange way

Customizing edit template... in a strange way

Author Message

Nabil Alimi

Sunday 12 June 2005 1:43:59 am

Hi,

I created a class "formation" with several fields.
Most of them are just common text fields. But there are two of them which I want to be "selections".
But the problem, is that I want the combo box to be filled dynamically with content created by the webmaster.
In order to, i created a class named "type" and all of thoses "type" content will be stored in a folder.
Then, when the user creates new content "formation", the normal text fields just display and the <select> is field with <option ...> TYPE.

When customizing the edit template, it only shows "edit_attribute.tpl". I checked the edit_attribute.tpl file but i dont really understand how does it works.
I'd like to somehom restrict the displayed fields in edit_formation.tpl to normal text fields.

Thanks for reading me.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Paul Borgermans

Sunday 12 June 2005 3:30:30 am

Hi ,

I would suggest to use the objectrelation datatype for the "selection fields" . This does exactly what you want without needing to edit the edit template(s)

Just use a drop down list for the selection method and slect the node/folder where your types are listed. If there is a new type added, it will automatically appear in the drop down list when editing your "formation" class

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Nabil Alimi

Sunday 12 June 2005 8:37:44 am

That sounds really good. :)

I'll give it a try. Thanks a lot ! :)

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Nabil Alimi

Sunday 12 June 2005 10:54:59 am

I followed your advice Paul, but it seems that Object Relations is restricted to objects created before the class is created. The only choice in the type dropdown box is "only existing objects".
Is there a way to set it to get even new content ?

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Paul Borgermans

Sunday 12 June 2005 12:41:42 pm

Ah,

I thought your type objects existed before objects of the formation class are created and that over time, some new types may be defined which will be available when editing existing formation objects or new formation objects.

But can't you create the folder already and fill it with a dummy type before ceating the formation class?

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Nabil Alimi

Sunday 12 June 2005 2:48:10 pm

Well. I just can't understand what's happening. ^^

I tried a couple of hours ago and "objectrelation" didn't match what i expected. Then i tried with "objectrelationS" and it did, but it worked only with existing content (as i explained).
And I tried again with "objectrelation" and it works exactly like i'd like. Content added after the creation of the class is displayed in the dropdownbox...
I swear i'm not drunk.

Anyway thanks for your help Paul. ^^

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr