Forums / Developer / Using atributes of users class
Pavel Konovalov
Friday 03 November 2006 4:24:27 am
HI 2 all!I have some trouble when I use users class.
I create a class. This class consist of 10 attributes. One of them has type "Selection".This attribute have 10 "Options".
Condition: When I select one from 10 options (for example 5th) and reload page, I need to disable some other ones (for example 1st and 2nd). How can I do this?
Maybe I should use JavaScript, or maybe there is another way to solve this problem?
Are you gangsters?! No, we are Russians.
Claudia Kosny
Tuesday 07 November 2006 11:17:04 am
Hi Pavel
Javascript would certainly be an option although it is inherently unsafe. The nice thing about javascript is that your user does not need to reload the page.If you want to do it in the template you can create an override for the \design\standard\templates\content\datatype\edit\ezselection.tpl template. Just get the selected option from the attribute content and disable the other options as required.
Claudia
Tuesday 07 November 2006 11:33:51 am
Hi Claudia >Just get the selected option from the attribute content and disable theother options as required.
But how I can do that?
Tuesday 07 November 2006 11:46:11 am
Hi
Have a look at the template I mentioned before. There you have
... {let selected_id_array=$attribute.content} ... <option value="{$Options.item.id}" {section show=$selected_id_array|contains( $Options.item.id )}selected="selected"{/section}>{$Options.item.name|wash( xhtml )}</option> ...
This shows that $selected_id_array is an array that contains the selected option(s).
Tuesday 07 November 2006 11:58:43 am
Tthank you, Claduia!Maybe, I solve my trouble.