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.