Problem with CheckBox in the Form!!!

Author Message

Leandro Alves

Thursday 20 January 2005 3:52:29 am

Hello!!!!

My eZ version is 3.5....
I trying to make a form with textbox, radio button and checkbox in the same form, but I am having problem with the Checkbox options.

<b>-></b> For the common options like name, address, message I am using "Text Line" and "Text field" and the the code below in my full form template:

 {attribute_view_gui attribute=$node.object.data_map.name}
 {attribute_view_gui attribute=$node.object.data_map.address}
 {attribute_view_gui attribute=$node.object.data_map.message}

This information are collected with no problem.

<b>-></b>For the <b>Radio Buttons Options</b> I have created with the datatype "Selection".

If I use with the code below, the options are showed in drop list display

 {attribute_view_gui attribute=$node.object.data_map.question}

To show the options in Radio Button Options I have used this code from POLL template source:

{let attribute=$node.object.data_map.question
     option_id=cond( is_set( $#collection_attributes[$attribute.id]),
     $#collection_attributes[$attribute.id].data_int,false() )}

<h3>{$attribute.content.name} 1</h3>

{section name=OptionList loop=$attribute.content.option_list}
   <input type="radio" name="ContentObjectAttribute_data_option_value_ 
{$attribute.id}" value="{$OptionList:item.id}"

{section show=$OptionList:item.id|eq($option_id)}checked="checked"{/section}
/>{$OptionList:item.value}<br />

{/section}
{/let}

<b>-></b>For the <b>Checkbox Options</b> I have tried with the datatype "Selection" too and I changed the code above <b>type="radio"</b> for <b>type="checkbox"</b> instead.

With this, the options are showed in checkbox form, and you can select one, two or all of them, but only one (the last selected) is collected by the form.

<b>Question:</b>

- What Can I do to do for the checkbox options works fine in my form?
- How Can I change de code above to collect more then one options???
- Does it the best form to collect data from Checkbox??

Please, send me any help....

Thanks a lot!
Leandro

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.