Forums

Chronoconnectivity Edit form not selecting record

tshirley 06 Mar, 2015
Hello,

I have tried to chase this one before but no luck at all.

So I started from scratch and follwed the two tutorials. I created a basic entry form and a table with just one field (name).

I created a CCV5 connection with a Model name and the necessary fields, and then I could see the list of records I had entered.
I added an _EDIT_ into the field list and that gave me the Edit link in the list against each record.
I created an "edit" version of the form with the field name Model[name], and a hidden field with Model[id] as that is the primary key of the table. I added a HTML action to the On Load and a Connection action in the On Submit, to go back to the Connection and save.
I added the editform:load into the edit action of the connection.

According to the tutorial that is all I have to do...

So, when I select a record in the CC list and click edit, I get the form OK but the fields are not populated. The URL looks ok, it has a parameter of &gcb=1 where 1 is the selected id. But if I enter a value and submit, it goes back to the connection and adds a new record.

So I add a debugger to the form and look at the query, it show the query with "WHERE Model.id = '' so that is obviously my problem. The parameter value isn't in the query.

So, what have I done wrong? How does the value of gcb get into the query? Do I need a DBRead for it? The tutorial does not say so..

Cheers

Tim
GreyHead 06 Mar, 2015
Hi Tim,

I'm unclear - is your Model name 'Model' or something different? For example if your Model name is 'Trees' then your form inputs would be Trees[name] and Trees[id]

Bob
tshirley 06 Mar, 2015
Hi Bob,

I used the Model Name "T". Perhaps channeling a vintage Ford?🙂

So the only fields in the form have names T[mbr_name] (a Text box) and T[id] (a Hidden box). id is the primary key of the table and contains also the field mbr_name.

The url for the edit form as generated by the connection looks like this:

http://glidingaustralia.org/component/com_chronoconnectivity5/act,edit/ccname,test/cont,lists/&gcb=1

The parameter value gcb=1 is correct as it is the value in the id field of the record selected in the connection for edit.

The debugger shows this:

SELECT `T`.`id` AS `T.id`, `T`.`uniq_id` AS `T.uniq_id`, `T`.`user_id` AS `T.user_id`, `T`.`created` AS `T.created`, `T`.`modified` AS `T.modified`, `T`.`mbr_name` AS `T.mbr_name` FROM `glid_chronoengine_chronoforms_datatable_test_form` AS `T` WHERE `T`.`id` = ''

What appears to happen from this, is that a query is executed but it does not include the value of the gcb parameter in the WHERE clause. So the form does not populate.

If I then enter a value in the empty T[name] field and Submit, the Connection action works. It returns to the Connection and saves a new record, which is exactly what I would expect to happen if the T[id] field is empty.

One thing that does puzzle me is that I don't know how in this setup, the form will know what the record's primary key field is. The information doesn't appear to be passed across.

Cheers

Tim
tshirley 14 Mar, 2015
Hi,

Any thoughts on this one? I have really done nothing except what the tutorial says and I get nothing at all in the edit.

Cheers
GreyHead 14 Mar, 2015
Hi Tim,

It looks like the problem is with the SEF URL - a query string needs to start with ? and there is no ? in there. Can you tell your SEF component to ignore CC and CF URLs?

Bob
tshirley 14 Mar, 2015
OK tried setting all CC and CF off in sh404sef and got a 404:

http://glidingaustralia.org/component/chronoconnectivity5/?cont=lists&ccname=test&act=edit&gcb=1

Then tried disabling sh404sef in plugin manager and it populated, with the url:

http://glidingaustralia.org/component/chronoconnectivity5/?cont=lists&ccname=test&act=edit&gcb=1

Looks the same to me so not sure why one works and the other doesnt.

But can I now convince my webmaster to do without sef? I doubt it ...

Cheers

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