Buy Now
Sign in

Update "entry" form

pedders , October 19 at 20:35
p
pedders

I'm having a little trouble, i need a dummies guide!
(Easy bit!)
I have a form that a Joomla (v3.8.1 with CF 5.0.16) user can fill out and save into the database following details:
Company - (pre populated drop down menu)
Contact name - (txt box)
Contact Phone - (txt box)
Email - (txt box)
number of teams - (pre populated drop down menu)
Notes - (txt area)
Year- Hidden text field that has a year number already populated

(Hard bit)
If a user (not necessarily the same one) comes to the form but using the same company name, i want it to read the data from the database and re-populates the drop down menu and text boxes with the values they can then alter, resubmit and it will update that DB record.

Basically if I'm not making it too difficult to understand, I want it so each company can have 1 record for each Year (the hidden text field)

I tried following the PDF attached to the below thread but i couldn't get adapt it to work how i want, not really being a programmer i don't understand the code very well:
https://www.chronoengine.com/forums/posts/t98210/p342409.html

I'd really appreciate some help

GreyHead

Hi pedders,

There are a couple of ways to do this but the simplest is probably to make this a multi-page form. On the first page have just the Company name drop-down and a submit button. When that submits use an Event Switcher action to check if there is an existing record and show either the form or a 'sorry, you've already completed this' message.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

p
pedders

Thanks,
IF there is already a record for a company i dont want to exclude them, i just want them to be able to pre populate the form with the details for that company which user can then edit if required.

GreyHead

HI pedders,

OK - similar process but instead of an Event Switcher use a DB Read action to load the saved data.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

p
pedders

Thanks again, sorry for asking the dummy questions still :)
I got a DB Read and using the debugger it seems to be reading the data into "somewhere" how do i get it to enter the data read into the text boxes/combo boxes?

GreyHead

Hi pedders,

Provided that that the input names match the names of the data items CF will auto-load the values. The Model ID can get in the way of this - either you need to include that in the input names as e.g. model_id[input_name] or you leave the Model ID empty in the DB Read - just make sure that this does not cause any conflicts.

There is another complication if you have multi-choice select or check-box groups when you need to have some custom code to convert data saved as strings back to arrays.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much