Page 1 of 1

FormBuilder validation with UDT on multi-page form

Posted: Sun Apr 12, 2015 12:16 am
by bairdmw
Hi,
I have a Formbuilder form which has 2 pages. An option selected on the first page determines which fields are displayed on the 2nd page. I have this working fine using jQuery.

However, I want to do some form validation on the 2nd page which can't be done using the Formbuilder validation, so I need to call a UDT on form submission. However, the UDT gets called on submission of each page (ie. when clicking Next from page 1 to page 2 of form). How do I check in the UDT if the form page being submitted is page 2 or page 1?

I basically need to be able to test the $this_page value from the form, but I can't access this variable from the UDT.

Thanks!

Re: FormBuilder validation with UDT on multi-page form

Posted: Mon Apr 13, 2015 8:19 am
by velden
You could have a look at what data is available in the submission.
Just print it out in the UDT (good tip I learned on GeekMoot: print stuff you want in UDT and end with

Code: Select all

die();
In this case, you need to add this statement just before hitting the final submit button.

If I look at the submission of my sample form and use a web inspector to see what data is submitted I find:

Code: Select all

mact	
FormBuilder,cntnt01,default,0
cntnt01returnid: 23
cntnt01fbrp_callcount: 4
cntnt01form_id: 2
cntnt01fbrp_continue: 3
cntnt01fbrp_previous: 1
cntnt01fbrp_done: 1
...
I'd guess the 'done' value of 1 would be worth a try...

Re: FormBuilder validation with UDT on multi-page form

Posted: Sat Apr 18, 2015 12:21 am
by bairdmw
Thanks velden.

I worked out that I can add a hidden form field in the Form Template and assign the value of $this_page to that field. Then, when page 1 of the form gets posted, I can read the value of that form field from the UDT using $_FORM[field_name]

Appreciate the tip!