Share » Forums » Developer » attribute_view_gui default value

attribute_view_gui default value

attribute_view_gui default value

Monday 16 June 2008 8:11:33 pm - 2 replies

Modified on Monday 16 June 2008 8:13:32 pm by Michael Scofield

Author Message

Michael Scofield

Tuesday 17 June 2008 12:49:12 am

Problem solved!

If anyone goes into this problem one day, I solved the problem doing template overrides for all datatype templates included in my formulary. That are:

content/datatype/collect/ezstring.tpl
content/datatype/collect/ezemail.tpl
content/datatype/collect/ezselection.tpl
content/datatype/collect/ezboolean.tpl

Inside this files I created some code to get the default value for each attribute from POST variables.

Thank you anyway.
Michael Scofield

Horst Lindlbauer

Thursday 17 July 2008 8:03:57 am

Hi Michael,
I wonder how your solution could possibly work, if you have more than one occurrence of a data type?
I think a better solution is to have a look at the collect templates which attribute_view_gui uses in forms and learn from the html there.

If

{attribute_view_gui attribute=$node.object.data_map.your_attribute size='30'}

produces the correct input field for an attribute, the following code works to implement a default value :

<input class="box" type="text" size="30" name="ContentObjectAttribute_ezstring_data_text_{$node.object.data_map.your_attribute.id}"  	value="{$my_default_value}" />

Thereby it is also possible to pass the default value to a hidden field off course:

<input type="hidden" name="ContentObjectAttribute_ezstring_data_text_{$node.object.data_map.your_attribute.id}"  	value="{$my_default_value}" />

This worked perfectly for me and it should be easy to transfer this solution to other datatypes.

---------------------------------------
http://www.lbm-services.de

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu