Forums

Multipage Form

dwhiting 30 Mar, 2019
I have the following issue:

I'm doing a multipage form. When the user clicks Next on the first page, a Save to dB action is triggered with Insert as the action and then Display Section two in the Success action. This works perfect.

However, after completing page 2, I have a 2nd Save to dB action with UPDATE as the action. The issue is, that the update then updates ALL records in the table with the values of the form fields.

I've tried setting the the Update Conditions to:
phone:{data:phone} where 'phone' is the name of a text field on page 2 and also the name of a field in the dB table.

This is not working and only updates records where phone is empty. It appears {data:phone} is not capturing the value typed in the 'phone' field on the form.
If I set the Update Conditions to:
phone:1112223333 and then enter 1112223333 in the 'phone' field on the form it works as expected. So again I think its that {data:phone} is not capturing the form data.

Now the funny thing is, if I use {data:phone} in the body of an Email function, it gets captured properly. What am I doing wrong?? I hope someone can help. I've read through the forums and have tried using this php custom code before the Save action:

$this->data['phone'] = $this->data['phone']; and then putting phone:{data:phone} in the Update Conditions but then it again updates ALL records where 'phone' is empty.
Max_admin 30 Mar, 2019
Can you post a screenshot of your update conditions ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dwhiting 30 Mar, 2019
Sure, here it is.
healyhatman 30 Mar, 2019
Have you used a multipage action in the first submit event? Because {data:phone} won't be available on the second submit event, you should use a multipage action and then use {session:multipage.phone}
dwhiting 31 Mar, 2019
OK, that worked, I am now able to access the 'phone ' field across all my pages.

So, now that I have that working, I want to have a hidden field called SubmissionID on the first page set to a unique random number and then pass that number to the following pages to use in the Update Conditions. Is there a way to do that? I see how to set a text field as hidden, but can I set it's value to a random number using php or some other way?

Thanks again,

Danny
healyhatman 31 Mar, 2019
Exactly the same way. Use a Hidden field (under Extras) and set its value to {uuid:}
dwhiting 31 Mar, 2019
So then, can I access it on other pages using {session:multipage.hidden_field_name}? Our website is down at the moment so I can't try it now.
dwhiting 31 Mar, 2019
So then, can I access it on other pages using {session:multipage.hidden_field_name}? Our website is down at the moment so I can't try it right now.
dwhiting 31 Mar, 2019
OK, the website is up now and I have it all working as required. Thanks for your help!!
dwhiting 31 Mar, 2019
Sorry, one last thing. Instead of saving to dB after every page of form, can I just do one Insert action at the end? That way nothing is saved if the user doesn't complete the survey.

Thanks again.
Max_admin 31 Mar, 2019
Yes you can, set your "Save data" provider to
{session:multipage}

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dwhiting 01 Apr, 2019
Thanks, got it working. I think I'm done for sure now!
This topic is locked and no more replies can be posted.