Forums / Setup & design / Radio Button and CheckBox in the same FORM?

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

eZ debug

Timing: Jan 31 2025 01:28:17
Script start
Timing: Jan 31 2025 01:28:17
Module start 'content'
Timing: Jan 31 2025 01:28:17
Module end 'content'
Timing: Jan 31 2025 01:28:17
Script end

Main resources:

Total runtime0.2535 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0093 588.0625370.2734
Module start 'content' 0.00930.0135 958.33591,001.5938
Module end 'content' 0.02280.2307 1,959.92973,893.0391
Script end 0.2535  5,852.9688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00481.8759200.0002
Check MTime0.00140.5357200.0001
Mysql Total
Database connection0.00140.552910.0014
Mysqli_queries0.148258.46131410.0011
Looping result0.00180.70741390.0000
Template Total0.230390.810.2303
Template load0.00070.275710.0007
Template processing0.229690.552110.2296
Override
Cache load0.00050.213010.0005
Sytem overhead
Fetch class attribute can translate value0.00220.885110.0022
XML
Image XML parsing0.00020.083610.0002
General
dbfile0.00662.6170200.0003
String conversion0.00000.003130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs