Question How to stop activating new view if javascript validation fails

Elfman

Member
Joined
Nov 6, 2007
Messages
12
Programming Experience
1-3
Hi all,

I'm developing a web form using the muliview control in VS web developer 2008. the first view has a submit button which when pressed causes some java script to validate the data entered and if it fails it highlights the first field with incorrect data. If it's all fine then it activates the next view.

To do this i use the following code:

in default.aspx :
OnClientClick="return ValidatePageOne()"

and default.apsx.vb (under the on_pageLoad()) :
BtnContinue.Attributes.Add("onclick", "return ValidatePageOne()")

and I just return true or false from my java script as needed . this works fine however when i do the same thing for the button on the next view it validates fine but then still goes on to the next view even if JavaScript returns false.

How do i stop this ? could it be where i'm putting the BtnSubmit..Attributes.Add("onclick", "return ValidatePageOne()
bit ?

Any help would be brilliant

Thanks

- Elfman
 

Latest posts

Back
Top