I have a form that used to work until I introduced a database relationship. When I launch the form, I can see with the debugger that the data is being retrieved and stored properly in the form array. For some reason however, when I render the HTML, the data no longer populates. I am suspecting that it has something to do with the fact that I have now have 2 arrays of different names, but I can't seem to get it to load the data anymore. I have a form with the following fields:
1) Record ID (cf_id) - HIDDEN FOR UPDATES WITH SUBMIT
2) Problem Title (problemTitle)
2) Problem Description (problemDescription)
3) Submit Button
Here is the output of my debugger:
Array
(
[option] => com_chronoforms5
[chronoform] => ProblemReview
[cf_id] => 52
[f7517f7ac0d58b9e3078b9d6c7d98d45] => 1
[problem] => Array
(
[cf_id] => 52
[problemTitle] => Test problemss
[problemDescription] => <p>This is a test problem to be used in testing.</p>
[fileUpload] =>
)
[user] => Array
(
[email] => blah@blah.com
)
)
Array
(
[16] => Array
(
[DB Read] => Array
(
[Queries] => Array
(
[0] => SELECT `problem`.`cf_id` AS `problem.cf_id`, `problem`.`problemTitle` AS `problem.problemTitle`, `problem`.`problemDescription` AS `problem.problemDescription`, `problem`.`fileUpload` AS `problem.fileUpload`, `user`.`email` AS `user.email` FROM `jos_cf_Problem` AS `problem` LEFT JOIN `jos_users` AS `user` ON problem.user_id = user.id WHERE `problem`.`cf_id` = '52' GROUP BY `problem`.`cf_id`
)
)
)
)
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
My form data isn't saving to the database correctly
My CFv5 form data isn't saving to the database correctly
How do I save form data to a database table?
How to load record data from a database table into your form
P.S: I'm just an automated service😉
Your last link solved the problem...I had to add the MODELID to the Fieldname (eg. MODEL[field]).
First time an automated robot has helped me...cool!
I can't get the form data to load on edit. I've followed this tutorial https://www.chronoengine.com/faqs/72-ccv5/5208-connectivity-edit-with-chronoforms.html
Here's the debugger data:
Data Array
Array
(
[cont] => lists
[ccname] => IMedit
[act] => edit
[gcb] => 116
[IM2017] => Array
(
[id] => 116
[uniq_id] => 9ee346c18ca860ca2699248ea9144b6383054e6c
[user_id] => 0
[created] => 2016-12-04 22:22:24
[modified] =>
[uid] => IM371ZJ
[Medlem] =>
[Fornavn] => Roger
[Etternavn] => Langaard
[Stilling] => Guru
[Telefon] => +xxxxxxxxxx
[E_post] => roger@xxxxxxxx.xx
[Firma] => Selvstendig
[Firmaadresse] => xx
[Postnummer] => xxxx
[Poststed] => xxxxxxx
[Land] =>
[Bransje] => Raffinerier
[Antall_ansatte] => 1
[Invitert_av] => TESS Brumunddal
[Kategori] => Besøkende begge dager
[Kommentar] =>
[Send] => Submit
)
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
)
What exactly is the problem? I can see what appears to be some form data there . . .
Bob
The data is being loaded with the Model ID IM2017 - so your form element names need to use the same model id e.g. IM2017[Fornavn]
Bob
PS There are other ways to handle this but using the Model ID is probably the simplest.
All of the input names should be array names using the Model ID, e.g. Article[title] as explained in the previous tutorial. If you add IDs they need to be unique but should not include the [] characters - using e.g. title should work OK.
Thanks a lot again for your help 😀
Roger
