Radio Button and CheckBox in the same FORM?

Author Message

Leandro Alves

Wednesday 19 January 2005 9:17:00 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.

eZ debug

Timing: Jan 18 2025 19:37:36
Script start
Timing: Jan 18 2025 19:37:36
Module start 'layout'
Timing: Jan 18 2025 19:37:36
Module start 'content'
Timing: Jan 18 2025 19:37:37
Module end 'content'
Timing: Jan 18 2025 19:37:37
Script end

Main resources:

Total runtime0.7381 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.1641152.6406
Module start 'layout' 0.00540.0033 741.804739.4766
Module start 'content' 0.00870.7280 781.2813414.3203
Module end 'content' 0.73670.0014 1,195.60168.1250
Script end 0.7381  1,203.7266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4788160.0002
Check MTime0.00130.1756160.0001
Mysql Total
Database connection0.00080.103410.0008
Mysqli_queries0.694394.0553460.0151
Looping result0.00050.0635440.0000
Template Total0.704095.420.3520
Template load0.00230.309720.0011
Template processing0.701795.061220.3508
Template load and register function0.00020.033010.0002
states
state_id_array0.00120.158810.0012
state_identifier_array0.00140.193420.0007
Override
Cache load0.00190.2561230.0001
Sytem overhead
Fetch class attribute can translate value0.00110.153510.0011
Fetch class attribute name0.00100.131610.0010
XML
Image XML parsing0.00010.015710.0001
class_abstraction
Instantiating content class attribute0.00000.001110.0000
General
dbfile0.00090.1162100.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs