Make each tab navigator page an independent form

Posted on 2005-04-20
Last Modified: 2013-12-24

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?

Question by:twistercomputer
    LVL 35

    Accepted Solution

    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.
    LVL 20

    Expert Comment

    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)

    LVL 20

    Assisted Solution


    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">

    Author Comment

    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?
    LVL 35

    Expert Comment

    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.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
    Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now