I followed the FAQ's of CCV5 to view, edit and save changes of registries generated by a form build with CFV5:
"Basic Connectivity v5 listing"
"Connectivity edit with Chronoforms"
The registries list is showing ok, the edit column works fine and recovers the data correctly to the "edit" version of my initial form, but the problem appears when I make a change to the entries and try to save the form. I become the message "Connection not found".
For the editable form I did not create any table because I thought that all the data would save in the original table of my first form, is this correct? Or do I have to create a new table for this "editable" form?
Another problem I find is with the checkbox groups:
in the new editable form I used the field names like is described in the FAQ: Article[title]. For the checkbox group I named the elements like Article[title[]], and it retrieves only one of the selected options of the checkbox group. I tried also naming the field without the square brackets Article[title] and in this case it doesn't retrieve any of the options. With is the correct form to do this?
"Basic Connectivity v5 listing"
"Connectivity edit with Chronoforms"
The registries list is showing ok, the edit column works fine and recovers the data correctly to the "edit" version of my initial form, but the problem appears when I make a change to the entries and try to save the form. I become the message "Connection not found".
For the editable form I did not create any table because I thought that all the data would save in the original table of my first form, is this correct? Or do I have to create a new table for this "editable" form?
Another problem I find is with the checkbox groups:
in the new editable form I used the field names like is described in the FAQ: Article[title]. For the checkbox group I named the elements like Article[title[]], and it retrieves only one of the selected options of the checkbox group. I tried also naming the field without the square brackets Article[title] and in this case it doesn't retrieve any of the options. With is the correct form to do this?
Sorry my fault, I made a mistake typing the connection name.
But still unable to recover multi answers when using checkbox group, any ideas?
But still unable to recover multi answers when using checkbox group, any ideas?
I've been reading around the forum a little more and found a post with the same problem with the checkbox group and the solution offered by Max seemed to solve the problem but I'm not getting to apply it to my case.
This is the post:
https://www.chronoengine.com/forums/posts/f3/t96921.html?page=1
The proposal is to add a custom code to explode the data in the checkbox group when loaded to the "editable" form. This custom code should be placed after a DBread action. In my case I don't have any DBread action in any of the forms (the first one for data input connected with another form for editing).
Should I place a DBread action in any of them?
In which one?
Thanks
My actual config.
[attachment=0]Captura de pantalla 2015-08-03 a las 10.58.10.png[/attachment]
[attachment=1]Captura de pantalla 2015-08-03 a las 10.58.46.png[/attachment]
[attachment=2]Captura de pantalla 2015-08-03 a las 11.01.54.png[/attachment]
This is the post:
https://www.chronoengine.com/forums/posts/f3/t96921.html?page=1
The proposal is to add a custom code to explode the data in the checkbox group when loaded to the "editable" form. This custom code should be placed after a DBread action. In my case I don't have any DBread action in any of the forms (the first one for data input connected with another form for editing).
Should I place a DBread action in any of them?
In which one?
Thanks
My actual config.
[attachment=0]Captura de pantalla 2015-08-03 a las 10.58.10.png[/attachment]
[attachment=1]Captura de pantalla 2015-08-03 a las 10.58.46.png[/attachment]
[attachment=2]Captura de pantalla 2015-08-03 a las 11.01.54.png[/attachment]
Hi Andresvwt,
I think that CC is probably doing the DB Read for you in the edit form. Please try putting the Custom Code action before the HTML (Render form) action in the On Load event and see if that works OK.
Bob
I think that CC is probably doing the DB Read for you in the edit form. Please try putting the Custom Code action before the HTML (Render form) action in the On Load event and see if that works OK.
Bob
Doesn't work. I also tried to put a DBread after the custom code and it doesn't handle to retrieve the multiple options of checkboxes. I don't understand where the problem is. I'm stuck with this. Any other ideas?
Thank you very much Bob
Thank you very much Bob
I'm thinking that maybe I didn't understand the PHP (I don't have idea of it). Do I have to substitute in the code proposed by max with my data?
if my model is "regcsp" and my form name is "CRDCSP" should the code look like:
<?php
$form->data["checkboxes_name"] = explode(",", $form->data["checkboxes_name"]);
if my model is "regcsp" and my form name is "CRDCSP" should the code look like:
<?php
$CRDCSP->regcsp["checkboxes_name"] = explode(",", $CRDCSP->regcsp["checkboxes_name"]); ?
Hi Andresvwt,
No; leave it unchanged except for checkboxes_name which should be replace by the name of the CheckBox Group element
Bob
No; leave it unchanged except for checkboxes_name which should be replace by the name of the CheckBox Group element
Bob
I found this topic but still not able to find the correct syntax.
http://www.chronoengine.com/component/chronoforums/posts/f12/t98786.html
If my checkboxgroup has de Field name:
ap[] (this one in the form for creating new entries, the one that has the table created)
regcsp[ap] (this is the name in the form for editing pruposes)
and the Model Title in the CC connection is: regcsp. What does it have to look like?
Code proposal in the post:
What I tried (other options also, but I put this one because it seems to me the more closely to be correct one, obviously isn't)
Thanks
http://www.chronoengine.com/component/chronoforums/posts/f12/t98786.html
If my checkboxgroup has de Field name:
ap[] (this one in the form for creating new entries, the one that has the table created)
regcsp[ap] (this is the name in the form for editing pruposes)
and the Model Title in the CC connection is: regcsp. What does it have to look like?
Code proposal in the post:
<?php
if(!empty($form->data["Model"]["checkboxes_field"])){
$form->data["Model"]["checkboxes_field"] = explode(",", $form->data["Model"]["checkboxes_field"]);
}
What I tried (other options also, but I put this one because it seems to me the more closely to be correct one, obviously isn't)
<?php
if(!empty($form->data["regcsp"]["ap[]"])){
$form->data["regcsp"]["ap[]"] = explode(",", $form->data["regcsp"]["ap[]"]);
}
Thanks
Hi Andresvwt,
Please try
Bob
Please try
<?php
if( !empty($form->data['regcsp']['ap']) ) {
$form->data['regcsp']['ap'] = explode(',', $form->data['regcsp']['ap'] );
}
?>
That is to leave out the [] after ap
Bob
Thank you very much, after checking all the setup again I found the problem. I forgot to add a Handle Array action also in the editable form. Now it works. A last question on this issue: what is the correct syntax if I have to handle more checkboxes? I.e. another one named "fr"?
Thanks again.
<?php
if( !empty($form->data['regcsp']['ap']['fr']) ) {
$form->data['regcsp']['ap'] = explode(',', $form->data['regcsp']['ap']['fr'] );
}
?>
Is this correct?
Thanks again.
Hi Andresvwt,
That doesn't look right to me. The existing code should work - but it does depend on how you've named the checkboxes.
Bob
That doesn't look right to me. The existing code should work - but it does depend on how you've named the checkboxes.
Bob
The code works for one checkbox group, but I have many of them on my form but I don't know how to explode the data of more than one checkbox group. The code you suggest me for the checkbox "ap" works fine. How must the code look like if I want to retrieve the data of another checkbox named i.e "fr"? Thanks again.
Hi Andresvwt,
It should be exactly the same but with 'fr' in place of 'ap'.
Bob
It should be exactly the same but with 'fr' in place of 'ap'.
Bob
Excuses for my ignorance. That means that for each checkbox group should I place a custom code element with the code for retrieving the data?
Thanks.
Thanks.
Hi Andresvwt,
No, you can do it all in one custom code action something like this:
Bob
[[>> Later : updated to correct typo <<]]
No, you can do it all in one custom code action something like this:
<?php
$checkboxes = array(
'ap',
'fr',
'xx',
'yy',
'zz'
);
foreach ( $checkboxes as $c ) {
if( !empty($form->data['regcsp'][$c]) ) {
$form->data['regcsp'][$c] = explode(',', $form->data['regcsp'][$c] );
}
}
?>
That assumes that they are all named with the regscp model id.
Bob
[[>> Later : updated to correct typo <<]]
I tried with your example but doesn't work:
And yes all are named with the redcaps model id.
Thank you.
<?php
$checkboxes = array(
'ap',
'fr'
);
foreach ( $scheckboxes as $c ) {
if( !empty($form->data['regcsp'][$c]) ) {
$form->data['regcsp'][$c] = explode(',', $form->data['regcsp'][$c] );
}
}
?>
And yes all are named with the redcaps model id.
Thank you.
Hi Andresvwt,
Please correct my typo $scheckboxes should be $checkboxes.
Bob
Please correct my typo $scheckboxes should be $checkboxes.
Bob
This topic is locked and no more replies can be posted.