Forums

Div Based Multi-page Forms Validation.

kwelker 08 May, 2008
All,

I read the Suggestions & Hacks: multi-page form thread using a div based solution with interest and then successfully implemented it. The trick is validation should happen as you click "next" on each page for that particular div right? Current for me it's just happening on the last div when I click submit.

Has anyone already figured out how to make that happen for each page/div and can provide the solution before I start trying to figure it out?

Thanks,
Kevin
kwelker 08 May, 2008
I should point out the original thread on div based multi-page forms is here:
kwelker 08 May, 2008
The solution was to call to validate from the next button onclick. The validate code is nicely written to just validate unhidden elements so it works great!


<input type=button onclick=" if(!valid.validate()) Event.stop(ev) ; collapseElem('mainForm_1') ; expandElem('mainForm_2') ;"  
class="mainForm" value="Next Page" />


Thanks,
Kevin


http://www.linkedin.com/in/kevinwelker
Max_admin 22 Aug, 2008
the last code works but generates a JS error, for anybody else, this one doesn't make error :
function val1(e){
if(!valid.validate()) {
    return false;
}else{
    step_next(1);
}
}


and

<input type="button" value="Next Step" onClick="return val1(event);">
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mtnkatt69 06 May, 2009
Hello,

This is my first post here.
You guys have been awesome in everything you do.

I've been following all of your advice on a lot of things done for chronoforms.

I've been trying to validate the Multi-Page divisions as suggested above, and they don't work for me.

What I'm wanting is for when I click "Next Page" it validates all of the fields in this div mainForm_1
and either pops up error saying what fields they missed or shows up which fields need to be entered in red next to them (like when you click submit button)

I am using Chronoforms 3.1 RC4.11
I tried upgrading to RC5 but then the form would not fill in the values in their profile.

I guess I'm mainly just wanting to know how to call the validation function by using OnClick.
Then if it's valid, then goto next page.

When I use the code:
function val1(e)
{
  if(!valid.validate()) 
    {
    return false;
    }else{
    step_next(1);
      }
  }


It gives a javascript error, and says valid not defined.
Any further help would be appreciated.

Thanks,
Jeremy
This topic is locked and no more replies can be posted.