Hi there,
I'm using Joomla 1.5.10 / ChronoForms_V3.1_RC4.11.zip / ChronoConnectivity V1.2.zip
I have a form with multiple select checkboxes (about 30 of them). Using ChronoForms and array for the names [] they are saving to the database (Type varchar(255)) seemingly fine as comma separated values.
The problem I'm having is that looking at the list of items in ChronConnectivity, I click on Edit, using {edit_record} in the BODY to edit one of the records from the db, the form comes back up to be edited with the information from the db already filled in, except for the checkboxes, they are all empty.
How do I pull the checkboxes initially selected, back out from the database showing those checkboxes already checked, so that the Edit form can then allow changing those checkboxes?
When viewing the {edit_record} page, I get a Firebug error as follows in case that helps?
Thank you,
J
I'm using Joomla 1.5.10 / ChronoForms_V3.1_RC4.11.zip / ChronoConnectivity V1.2.zip
I have a form with multiple select checkboxes (about 30 of them). Using ChronoForms and array for the names [] they are saving to the database (Type varchar(255)) seemingly fine as comma separated values.
The problem I'm having is that looking at the list of items in ChronConnectivity, I click on Edit, using {edit_record} in the BODY to edit one of the records from the db, the form comes back up to be edited with the information from the db already filled in, except for the checkboxes, they are all empty.
How do I pull the checkboxes initially selected, back out from the database showing those checkboxes already checked, so that the Edit form can then allow changing those checkboxes?
When viewing the {edit_record} page, I get a Firebug error as follows in case that helps?
$("ChronoContact_KHCDocuments") is null
(?)()()chronoco...d&cids=32 (line 609)
(?)()()chronoco...d&cids=32 (line 608)
returns()()mootools.js (line 21)
returns()(undefined)mootools.js (line 21)
cloneEvents()(function())mootools.js (line 50)
cloneEvents()("domready", undefined, undefined)mootools.js (line 50)
parse()()mootools.js (line 59)
returns()()mootools.js (line 21)
returns()(DOMContentLoaded )mootools.js (line 21)
[Break on this error] $('ChronoContact_KHCDocuments').getInputByName2(field).addClass('required');Thank you,
J
Actually, I just realized that editing an entry that was submitted without any checkboxes being checked at all (since validation doesn't appear to be working for checkboxes???) those checkboxes don't save to the db from the {edit_record} form.
Hmmm... Are these bugs?
Thanks,
-J
Hmmm... Are these bugs?
Thanks,
-J
Hi demo38,
I'm not sure what is happening here. Checkbox results are harder to deal with than the straight-forward textbox values. It looks as though there may be a bug or a hiccup in the Javascript processing - $("ChronoContact_KHCDocuments") is null suggests that the form hasn't been found on the page. But there could be other causes too.
There are some changes coming in the way this Javascript is handled, hopefully they will fix this.
Bob
I'm not sure what is happening here. Checkbox results are harder to deal with than the straight-forward textbox values. It looks as though there may be a bug or a hiccup in the Javascript processing - $("ChronoContact_KHCDocuments") is null suggests that the form hasn't been found on the page. But there could be other causes too.
There are some changes coming in the way this Javascript is handled, hopefully they will fix this.
Bob
I read this thread before I did it and needed about 20 checkboxes, so I just did them without array. e.g.
<td>
<div class="form_element cf_checkbox">
<input value="Jackrabbit" title="" class="radio" id="Jackrabbit" name="Jackrabbit" type="checkbox" />
<label for="Jackrabbit" class="check_label">Jackrabbit</label>
</div>
</td>
When I edit a record, I find I can check off previously unchecked items and they save ok, but unchecking previously checked items doesn't save/clear the field. Having the fields default varchar is very convenient for this form, because the chronoconnectivity form only needs to list all the fields and the blank ones don't show (and I don't have to build up a string based on binary value only for boxes) e.g.
<td><b>Grooming: </b></td><td>{Atna} {Beaver} {Clearwater} {Devils_Elbow} {Doggie} {Eagle_Way} {Foxtrot} {Grizzly} etc. etc.
You can guess the huge fees I'm being paid to make such a website (zero :-) ), so I'd like to do it in the simplest manner and that was working nicely right up to the edit part.
Was there any movement on the js you were talking about or have I broken it in a different, silly way?
<td>
<div class="form_element cf_checkbox">
<input value="Jackrabbit" title="" class="radio" id="Jackrabbit" name="Jackrabbit" type="checkbox" />
<label for="Jackrabbit" class="check_label">Jackrabbit</label>
</div>
</td>
When I edit a record, I find I can check off previously unchecked items and they save ok, but unchecking previously checked items doesn't save/clear the field. Having the fields default varchar is very convenient for this form, because the chronoconnectivity form only needs to list all the fields and the blank ones don't show (and I don't have to build up a string based on binary value only for boxes) e.g.
<td><b>Grooming: </b></td><td>{Atna} {Beaver} {Clearwater} {Devils_Elbow} {Doggie} {Eagle_Way} {Foxtrot} {Grizzly} etc. etc.
You can guess the huge fees I'm being paid to make such a website (zero :-) ), so I'd like to do it in the simplest manner and that was working nicely right up to the edit part.
Was there any movement on the js you were talking about or have I broken it in a different, silly way?
Hi gemlog,
I think that the problem is that an unchecked checkbox returns nothing in the $_POST array, so ChronoForms doesn't know that there is a value to unset. And the Autogenerated code only updates the values from the $_POST array.
So the trick is to set up an array of expected values in the OnSubmit before box and make sure that any unchecked checkboxes are added to teh $_POST array with empty values. Then the process should work OK.
Bob
PS If you use a checkbox array then the whole array will be updated and I think it works OK.
I think that the problem is that an unchecked checkbox returns nothing in the $_POST array, so ChronoForms doesn't know that there is a value to unset. And the Autogenerated code only updates the values from the $_POST array.
So the trick is to set up an array of expected values in the OnSubmit before box and make sure that any unchecked checkboxes are added to teh $_POST array with empty values. Then the process should work OK.
Bob
PS If you use a checkbox array then the whole array will be updated and I think it works OK.
I've a similar problem : when i use {edit_record} all my fields are filled excepted multiple Checkboxes with only empty checkbox.
I use post array for the checkbox so perhaps i must fill the on submit code before, to check my chekboxes ? But i don't what is necessary to convert my db values a,b,c in a array used to check my multiple checkboxes.
I use post array for the checkbox so perhaps i must fill the on submit code before, to check my chekboxes ? But i don't what is necessary to convert my db values a,b,c in a array used to check my multiple checkboxes.
Hi Cali,
Hmmm . . . I'm not sure what the answer to this is. The code to expand the string into an array is
I would probably put it at the beginning of the Form HTML and then set the checkbox values using PHP.
Bob
Hmmm . . . I'm not sure what the answer to this is. The code to expand the string into an array is
$check0 = explode(',', $xxx);but this won't work in the OnSubmit Before box as it only runs after the form is submitted and you want to show the results when the form is displayed. I would probably put it at the beginning of the Form HTML and then set the checkbox values using PHP.
Bob
This topic is locked and no more replies can be posted.
