Make each tab navigator page an independent form


Im creating a request information form using a flash cfform. I have two seperate forms on two seperate tab pages, with a submit button on each page. The user will only be filling out either one of the forms. Each form has several required fields. The way it is now, if someone clicks submit on one page, it gives errors for not filling in the required information on the other page. Is there a way I can seperate these so that if someone clicks submit on one page, it only submits the info on that page?

Who is Participating?
Yes.  Make them separate pages.

This is the only way to do this if using flash forms because by definition a flash form contains the fields from all tabs and all are submitted at once.

So they need to be separate pages.

You can even have them look the same as tabbed navigation (have to write this with normal html cfml - not useing the cfform flash forms) although it seems to me to be a bit of a clunky interface to allow a user to be able to switch between two forms that must be submitted independantly.
Instead of making two seperate pages, and having two seperate forms, make one form with two regular buttons, define the action in the buttons "onClick" attribute like this...

<input type="button" name="button1"  .....  onclick="this.form.action='youractionpage.cfm?blah=#blah#&blah=#blah#';">
<input type="button" name="button2"  .....  onclick="this.form.action='yourOtherpage.cfm?blah=#blah#&blah=#blah#';">

Form attributes like so... <form name="yourForm" action="" method="post">

This will still give an error if you don't fill out your required fields, but you can submit to different locations this way.
Also another idea is to make templates of the forms you want

Say form1 is in myfirstform.cfm -- in your tabbed interface call the template <cfinclude template="myfirstform.cfm">
Say form2 is in mysecondform.cfm --- in your tabbed interface call the template <cfinclude template="mysecondform.cfm">

Then do a cfswitch/case statement to decide which template to use based on which tab you are on.

That would work, wouldn't take much script editing to get there from where you are now and would look the same, only with no errors :o)


Would look something like this, of course with your html and all, but this is the idea I think would work for you

<cfswitch expression="#MyTabNumber#">
    <cfcase value="1">
        <cfinclude template="myfirstform.cfm">
    <cfcase value="2">
        <cfinclude template="mysecondform.cfm">
twistercomputerAuthor Commented:
Well i was hoping to keep everything just to the one flash cfform. Is it possible to have the page redirect when one of the tabnavigation tabs in the cfform is clicked?  So like have  tab1 and tab2..   tab1 shows form1.  when you click tab2, it reloads the page but with the form2. So basically is there an actionscript i can put on the tab navigator to change url location?
If it is one form then all required fields must be filled out.

You can only have two different sets of required fields validated with 2 different forms.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.