yakamara / redaxo_yform_docs

Dokumentation für YForm
31 stars 30 forks source link

Checkbox always checked... #126

Closed 8i11y closed 5 years ago

8i11y commented 5 years ago

$yform->setValueField('checkbox', array("checkbox","Checkbox","0,1","1"));

checkbox is in the frontend, but is always checked and I don't get a value from it.... can anyone help ?

elricco commented 5 years ago

Hi @8i11y, I think the syntax is a little bit wrong (also in the documentation). This should be:

        $yform->setValueField('checkbox', array("checkbox","Checkbox","0"));

The first parameter in the array is the name for your field, the second one is the Label, and the third is a boolean for setting the default status - while 0 is false / not checked and 1 is true / checked.

What you always can do to get the right syntax of fields: Create a table with the Table Manager in YForm. Add a field of the type you wish to have in your form, fill in all the options that you need. Save the field. When in overview of the fields in your table Field overview - click the button on the top right which states: Form code - this will output the whole code for a form in PHP and Pipe notation and also which CONSTANTS you need in your email template.

alxndr-w commented 5 years ago

In YForm 3.0 hat sich der Syntax geändert, PR willkommen

8i11y commented 5 years ago

Hi @elricco, you're right, the syntax is like the one you mentioned. but that wasn't the fault. There was something wrong in the classic template - I already have correct it and send a pull-request which also is merged in 3.1 now :)

elricco commented 5 years ago

PR ist da - ich denke, dann können wir dieses Issue schließen, oder?

alxndr-w commented 5 years ago

Passiert automatisch, wenn der PR angenommen wird, sofern darin etwas steht wie closes #61 (habe ich gerade angefügt). Kannst du die Mini-Kleinigkeit noch korrigieren?