FormBuilder validation with UDT on multi-page form

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
bairdmw
New Member
New Member
Posts: 3
Joined: Sat Apr 11, 2015 11:52 pm

FormBuilder validation with UDT on multi-page form

Post 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!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: FormBuilder validation with UDT on multi-page form

Post 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...
bairdmw
New Member
New Member
Posts: 3
Joined: Sat Apr 11, 2015 11:52 pm

Re: FormBuilder validation with UDT on multi-page form

Post 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!
Post Reply

Return to “Modules/Add-Ons”