eZ Community » Forums » Developer » Radio buttons does not work

Radio buttons does not work

Radio buttons does not work

Thursday 22 January 2015 6:51:16 am - 5 replies


I have a piece of code in my form for radio buttons, the buttons display correctly, but noe result are given.

Code in form:

        <table>{let myattribute=$node.data_map.kjonn}{section name=Radio loop=array('Kvinne','Mann')}<tr><td>{$:item}</td><td><input type="radio" name="ContentObjectAttribute_ezstring_data_text_{$myatt\ribute.id}" value="{$:item}">{* $:item *}</input></td></tr>{/section}{/let}        </table>

The URL is: http://new10.neitileu.no/om_nei_til_eu/innmeldingsskjema

Any ideas anyone?

Thursday 22 January 2015 9:33:39 am

Hi Atle,

What exactly do you mean by "no results are given"?  The checkbox results are not displayed on the backend for the collectedinfo page?

Thursday 22 January 2015 9:36:51 am

That is correct, all aother fields are displayed, but not this one (kjonn). And, it's not an result page, it's an e-mail being sent, but i guess that's the same principle.

Thursday 22 January 2015 6:34:13 pm


First you should not write new code using the deprecated template syntax.

Both the let and section template language syntax functions are deprecated and should not be used.

Also I don't know if it's a copy and paste error or an actual code error but you have '\' char in the code "{$myatt\ribute.id}" and this could certainly cause a problem. Though after checking your website preview it seems that its just a forum copy and paste error and not a code error after all.

Also after reviewing the source code for your page I noticed that you enabled html debug comments. This helped me notice that you are writing custom code just for your ratio elements information collection form code.

This is where I think your problem is coming into place.

By default eZ Publish datatypes do not provide a ratio option (let alone one with information collection support). Re: https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Datatypes

In your custom content class, what datatype are you using for the ratio attribute in your form?

Your custom template code indicates ezstring which is confusing since your writing custom template code to support ratio input for an ezstring datatype.

You could very well be having problems because the information collection code for the unknown (ezstring?) datatype your using for storage does not support ratio input (My first guess).

My recommendation is stop the use of the custom template code to support ratio input entirely.

eZ Publish provides a supported solution for your input needs it's a datatype called ezselection (use with selection required) which provides for the more flexible and user friendly form element, a drop down selection menu. https://doc.ez.no/eZ-Publish/Tech...al/4.x/Reference/Datatypes/Selection

This datatype supports information collection out of the box and you would not need to write custom template code to support it's information collection.

I hope this helps!


Friday 23 January 2015 7:39:28 am

Hello again Heath and thanks for all your helt happy.gif Emoticon

The deprecated code is just because I used an old template, I know that let/section are deprecated. The slash btw are as you write just a copy/paste fault.

The input I used was ENUM - which is also deprecated I discovered reading your links. I tried altering it to ezselection (utvalg in Norwegian), and had no luck, this is the sample code I wrote into the template:

<ul>{for 0 to $node.object.data_map.kjonn.content|count()|dec as $counter}<li> ID : {$node.object.data_map.kjonn.content[$counter]} - VALUE : {$node.obje\ct.data_map.kjonn.class_content.options[$node.object.data_map.kjonn.value[$coun\ter]].name}</li>{/for}</ul>

From http://new10.neitileu.no/om_nei_til_eu/innmeldingsskjema

I am out of clues, I have searced the forums for a solution without luck.

Any ideas anyone?

Saturday 24 January 2015 1:38:48 am

Hello Atle,

Wow, lots to reply too. I'll try to be brief.

You should really avoid ENUM datatype, you seem to know that.

You should not need to write any code to ezselection datatype information collection.

Would you be so kind as to post your template code as a gist so I can get a complete picture of what exactly your doing in template code?



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from