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

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 31 2025 01:21:46
Script start
Timing: Jan 31 2025 01:21:46
Module start 'layout'
Timing: Jan 31 2025 01:21:46
Module start 'content'
Timing: Jan 31 2025 01:21:46
Module end 'content'
Timing: Jan 31 2025 01:21:46
Script end

Main resources:

Total runtime0.0198 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 588.1250151.2109
Module start 'layout' 0.00430.0030 739.3359220.6875
Module start 'content' 0.00730.0112 960.02341,009.7891
Module end 'content' 0.01850.0013 1,969.812541.9922
Script end 0.0198  2,011.8047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002211.0677140.0002
Check MTime0.00094.7166140.0001
Mysql Total
Database connection0.00073.513110.0007
Mysqli_queries0.002010.025430.0007
Looping result0.00000.045710.0000
Template Total0.00094.610.0009
Template load0.00073.438510.0007
Template processing0.00021.181910.0002
Override
Cache load0.00052.413110.0005
General
dbfile0.00115.353380.0001
String conversion0.00000.020540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

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

Time used to render debug report: 0.0001 secs