Forums

Form Data not Loading on Edit

natloz 05 May, 2016
And on to the next learning experience...

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`
                        )

                )

        )

)
natloz 05 May, 2016
1 Likes
Thanks Calculus00!
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!
rogeranton 05 Dec, 2016
Hi

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
(
)
GreyHead 05 Dec, 2016
HI rogeranton,

What exactly is the problem? I can see what appears to be some form data there . . .

Bob
rogeranton 05 Dec, 2016
All fields in the form is empty when I click edit. The form itself loads but not the data.
GreyHead 05 Dec, 2016
Hi rogeranton,

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.
rogeranton 05 Dec, 2016
Thanks. It's a little confusing though, since the tutorial states that square brackets should not be included in Model ID:

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
GreyHead 05 Dec, 2016
Hi Roger,

It's a bit ambiguous, the [] are not allowed in the element ID <input . . . name='IM2017[Fornavn]' id='IM2017_Fornavn'. . . /> That's an HTML requirement.

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