This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Forms - handling events, enum...

Forms - handling events, enum datatypes and information collection?

Forms - handling events, enum datatypes and information collection?

Monday 19 May 2003 3:09:44 am - 2 replies

++ Overall Situation:
I am developing a user feedback / information request form, similar to the one in the SDK documentation (ref:

++Situation 1- Enum Datatype, drop box presentation, information collector:
In the definition of the form object, I have included an enum datatype to allow people to select the topic of their feedback/information request ("please send me information about...","website feedback...", etc)
My aim was for people to select from these options in a drop-down box.

I can't select the enum data element as an "information collector", so when it is displayed in the actual form in the user site, it just shows the default value as text, not the drop-down select box that I'd hoped for.

Does anybody know how to do this, or is there a convenient work-around?

To get around the information collector issue, I'd thought of collecting the information from the object attribute definition, and then creating an html drop-box, and then write the result to the relevant attribute of the node attribute. Though then I'm not sure of how to write the result to the attribute. Any ideas?

++Situation 2 - EZ-Native handing of form submit events?
Once a form is submitted, ez seems to reload a new blank version of the form by default.

Is there an EZ-native method to handle form submission events, eg something that says "on submit, load node XX"?
If not, are there any other good ways of achieving this outcome?

Many thanks!

Modified on Monday 19 May 2003 4:13:11 am by Paul Wilson

Monday 19 May 2003 9:04:04 am


#Question 1:

We had a similar problem, discussed within:

This code works well for radio buttons:

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

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.


Modified on Monday 19 May 2003 9:06:47 am by Paul Forsyth

Sunday 25 May 2003 3:04:05 pm

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_{$}[]">
{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_{$}[]" value="{$EnumList:item.enumelement}" {section show=eq($EnumList:item.enumelement,$EnumListomg.gif EmoticonbjectList:item.enumelement)}selected="selected"{/section}>{$EnumList:item.enumelement}</option>
<option name="ContentObjectAttribute_data_enumelement_{$}[]" value="{$EnumList:item.enumelement}">{$EnumList:item.enumelement}</option>

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.

Modified on Sunday 25 May 2003 3:14:18 pm by Paul Wilson


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

36 542 Users on board!

Forums menu

Proudly Developed with from