Share » Forums » Developer » Forms - handling events, enum...

Forms - handling events, enum datatypes and information collection?

Forms - handling events, enum datatypes and information collection?

Sunday 18 May 2003 6:09:44 pm - 2 replies

Modified on Sunday 18 May 2003 7:13:11 pm by Paul Wilson

Author Message

Paul Forsyth

Monday 19 May 2003 12:04:04 am

Paul,

#Question 1:

We had a similar problem, discussed within:

http://ez.no/developer/ez_publish_3/forum/developer/radio_buttons_within_forms

This code works well for radio buttons:

{section name=Radio loop=array('1', '2', '3')}
<td>
<input type="radio" name="ContentObjectAttribute_ezstring_data_text
_{$node.data_map.contact.id}" value="{$:item}">{$:item}</input>
</td>
{/section}

You can see whats happening here and use the same code to <select><option> for combo boxes, where '$contact' is our enum attribute of the current node.

#Question 2:

Inside your modified collectedinfomail.tpl make sure this line is set to an appropriate node (ours here is 107):

{set-block scope=root variable=redirect_to_node_id}107{/set-block}

This will redirect the form after submission. We have a thank you article set up for this.

Hope this helps you.

Paul

Paul Wilson

Sunday 25 May 2003 6:04:05 am

Hi Paul,

Thanks for your reply ... it was incredibly helpful!

I've actually messed around a fair bit more to get the <option> version going. I eventually realised that I'd missed the **important clue** on all these approaches ... many useful methods that can be applied to each attribute can be seen used in the datatype code within the standard template (the directory design/standard/templates/content/datatype/edit). So, adapting code from there, I got an option box with the following:

(myenumattribute is the attribute we're interested in developing an option box for)

<select name="ContentObjectAttribute_select_data_enumelement_{$node.data_map.myenumattribute.id}[]">
{section name=EnumList loop=$node.data_map.myenumattribute.content.enum_list}
{section name=ObjectList loop=$node.data_map.myenumattribute.content.enumobject_list show=$node.data_map.myenumattribute.content.enumobject_list}
<option name="ContentObjectAttribute_data_enumelement_{$node.data_map.myenumattribute.id}[]" value="{$EnumList:item.enumelement}" {section show=eq($EnumList:item.enumelement,$EnumList:ObjectList:item.enumelement)}selected="selected"{/section}>{$EnumList:item.enumelement}</option>
{section-else}
<option name="ContentObjectAttribute_data_enumelement_{$node.data_map.myenumattribute.id}[]" value="{$EnumList:item.enumelement}">{$EnumList:item.enumelement}</option>
{/section}
{/section}

Note the way that the loop code gets past the need for the pre-defining the array in the ('1','2','3') manner that you'd used with the radio buttons.

Thanks again.

++Further Question...
The only trick I have yet to resolve is how to post the selected value with the form. For some reason it seems to be left out when the form is submitted.

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

36 542 Users on board!

Forums menu