Forums

Chronoconnectivity Edit form not selecting record

tshirley 09 Jan, 2015
Hi all,

I have created a Chronoconnectivity V5 Connection and I want to make an Edit form in CF5.

So I followed the tutorial here:

http://www.chronoengine.com/faqs/72-ccv5/5208-connectivity-edit-with-chronoforms.html

This is OK except that there is no record selected displayed in the form when the record is selected. The edit form appears but the fields are blank or default.

I have placed a Hidden Field on the form with cf_id. cf_id is the primary key of the table.

The url to the edit form reads:

mydomain.com/component/com_chronoconnectivity5/act,edit/ccname,MbrOpsReportList/cont,lists/&gcb=37

and 37 is the cf_id of the record I have selected.

I am not sure how CC tells CF that cf_id is to be used for record identification in the edit form, or how the record is selected - since no parameter is passed.

Cheers

Tim
GreyHead 09 Jan, 2015
Hi Tim,

I'm not expert in CCv5 but I think that there are two possibilities here. The record ID is being passed in the URL as &gcb=37 so this is available to the form.

+ It is possible that linking the form to a listing with the CC action makes it clever enough to use this as the primary key value for the table.

+ Otherwise you can put an entry in the Conditions box of a Db Read action to map across between the two:
<?php
return array( 'cf_id' => '{$form->data['gcb']}' );
?>

Bob
tshirley 10 Jan, 2015
Hi Bob,

Thanks - that got me a bit further. I set up a DB Read with Multi Read = "no" and the code as above in the condition. My hidden field is named cf_id.

The result however is that the edit form picked up the first record in the table, and did not select the one included in the URL (&gcb=37).

I tried a couple of other options - for example setting "model.gcb" in the condition, and naming the hidden field gcb instead of cf_id, and setting model[cf_id] as the name of the hidden field, and also setting the DB Read to a multi read = "yes". I did this in combinations as well. None of these selected any record.

The solution from here is probably fairly simple.

The main reason I'm doing this at all is that I can't more fields in the V4 version because I am running into resource problems and the form will no longer save.

Cheers

Tim
tshirley 10 Jan, 2015
Hi,

Further to this I got some debugging going and I have discovered that if I hard code the value:

<?php
return array( 'cf_id' => '37' );
?>


Then this works, but

<?php
return array( 'cf_id' => '{$form->data['gcb']}' );
?>


creates no WHERE clause at all. So perhaps the Conditions box doesn't like curly brackets?

I also tried to create a value by

<?php
return array( 'cf_id' => '<?php echo $form->data['gcb']; ?>' );
?>


but again no WHERE clause was generated.

So I'm a bit lost...

Cheers

Tim
kiwiup 13 Feb, 2015
Hi Tim,
do you find out the solution for your problem?

Best regards.

Kiwiup
tshirley 13 Feb, 2015
No, I got no reply from Max or Bob, and I have basically found other (but less satisfactory) solutions in CF4.
kiwiup 13 Feb, 2015
Hi Tim,
ok.
I will continue to find out a solution with CF5 and CC5.
Best regards.

Kiwiup
GreyHead 14 Feb, 2015
Hi both,

Sorry, lost track of this one.

Please try:
<?php
return array( 'cf_id' => $form->data['gcb'] );
?>
I think that will work in CFv5

Bob
kiwiup 14 Feb, 2015
Hi Bob,
thank you for your suggestion. I tried but isn't help to me about what I want to do.
I am finding a solution to manage this situation with these steps:
1. I made a form, Entry form, with 3 dropdown dynamically chained. This step is ok. I followed a FAQ explanation and I got it;
2. I made a form that shows the record with the values of dropdown element chosen before. Also this step works. I used a CC5 connected with a copy of form 1 (Entry form). I duplicated a form because I modifiied a name of field respect a Entry form: for example
dropdown1 (entry form) is became listexdrop[dropdown1] in a duplicated form. Listexdrop is the name of model id in CC5 connected with the table that contains a valuse of dropdowns element.
3. So the problem is this one. I inserted in form CC5 a edit button to open the record to modify a values of dropdowns element but the code about chained dropdown element didn't work because in the Ajax event of Entry form is wrote
<?php
return array( 'id_reg' => $form->data['dropdown1'] );
?>
but in the duplicated form I have listexdrop[dropdown1] name of field and the code above didn't work and I cannot change the value because because the mechanism of dropdown chain dosen't work.
Any suggestions?

Thanks in advance.

Kiwiup
This topic is locked and no more replies can be posted.