Forums / Setup & design / 3.1 -> check box in a form

3.1 -> check box in a form

Author Message

laurent le cadet

Thursday 26 June 2003 9:02:16 am

....someone could help me ? I can't find anything about this.

I'm trying to display a checkbox in a form but I don't have the correct syntax.
What I use : {attribute_view_gui attribute=$node.data_map.myidentifier}

But I have only YES or NO if the box is checked or not when I crate the form.

May I have the correct syntax or more generally a tutorial for the different objects ?

Bård Farstad

Tuesday 01 July 2003 1:27:23 am

You have the correct syntax. However the default template for boolean (checkbox) is to display yes or no. Here is the code for the template:

{$attribute.data_int|choose("No"|i18n("design/standard/content/datatype"),"Yes"|i18n("design/standard/content/datatype"))}

To get the integer value you can do:
{$node.data_map.myidentifier.data_int}

If you want to display a section you can do:

{section show=$node.data_map.myidentifier.data_int}
This will be shown if the checkbox i checked.
{/section}

--bård

Documentation: http://ez.no/doc

laurent le cadet

Tuesday 01 July 2003 1:41:08 am

....someone could help me ? I can't find anything about this.

Thanks Bård for this new step.

So now it display the integrer 0 or 1 but what I want is a "real" checkbox whose result can be send by mail with the other elements of the form.
Any suggestion ?
Thanks

Bård Farstad

Friday 04 July 2003 6:20:39 am

To get checkboxes on information collectors you would need to use strings at this time. If you just change the template of the attribute you would like to be shown as a checkbox to use <input type="checkbox" .../> instead of using <input type="text" .. /> you will be able to fetch the input from the text box and it will be stored in the database.

Checkboxes/boolean do not support information collection yet, so you have to use this workaround.

--bård

Documentation: http://ez.no/doc

laurent le cadet

Tuesday 08 July 2003 6:19:46 am

Bård,

I'm not sure to understand what you explained.
But I tryed another way :

{let myattribute=$node.data_map.myidentifier}

<input type="checkbox" name="ContentObjectAttribute_ezstring_data_text_{$myattribute.id}" value="{$:item}">{$:item}</input>

{/let}

Still the same result. For sure it print a checkbox, but I still can't recieve the information if it has been check or not. Nothing.

I'll be very happy to have light on it.

Laurent

Graham Tillotson

Thursday 28 August 2003 12:28:00 pm

In response to Bard's suggestion to change the attribute template, where is this done? In which file?

DUO : CONSULTING
Web content management experts
www.duoconsulting.com

Paul Forsyth

Friday 29 August 2003 12:15:50 am

Try this out. In the file:

kernel/classes/datatypes/ezboolean/ezbooleantype.php

We added this function, which turns the datatype ezboolean (a checkbox) into an information collector.

function isInformationCollector()
{
----return true;
}

This works for us in 3.1. 3.2 has this functionality built in.

Paul

Graham Tillotson

Friday 29 August 2003 7:36:10 am

I just about fell out of my chair from joy -- thanks! Works perfectly.

DUO : CONSULTING
Web content management experts
www.duoconsulting.com

laurent le cadet

Tuesday 09 September 2003 7:08:56 am

Unfortunatly it's rather different in my case. 2 round eyes...what are they talking about...

I tried this new method :

function isInformationCollector()
{
return true;
}

...whithout any results.

I turn paranoïd "Forms don't like me".

May I have some help or a link to a tutorial ?

Laurent

eZ debug

Timing: Jan 18 2025 10:59:52
Script start
Timing: Jan 18 2025 10:59:52
Module start 'content'
Timing: Jan 18 2025 10:59:53
Module end 'content'
Timing: Jan 18 2025 10:59:53
Script end

Main resources:

Total runtime0.8598 sec
Peak memory usage4,096.0000 KB
Database Queries216

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.8203180.8438
Module start 'content' 0.00570.6824 769.6641699.5313
Module end 'content' 0.68810.1713 1,469.1953344.4688
Script end 0.8594  1,813.6641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00460.5343210.0002
Check MTime0.00150.1782210.0001
Mysql Total
Database connection0.00100.113110.0010
Mysqli_queries0.752187.48102160.0035
Looping result0.00280.32122140.0000
Template Total0.832596.820.4162
Template load0.00210.242720.0010
Template processing0.830496.580520.4152
Template load and register function0.00010.012210.0001
states
state_id_array0.00080.089810.0008
state_identifier_array0.00090.105720.0005
Override
Cache load0.00190.2174710.0000
Sytem overhead
Fetch class attribute can translate value0.00210.247050.0004
Fetch class attribute name0.00190.2228120.0002
XML
Image XML parsing0.00320.371050.0006
class_abstraction
Instantiating content class attribute0.00000.0039170.0000
General
dbfile0.00810.9422400.0002
String conversion0.00000.000630.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 42
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs