• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

jquery is overriding the JS validation

Contributor ,
Oct 22, 2015 Oct 22, 2015

Copy link to clipboard

Copied

Hi,

I am using this JS validation

JavaScript Form Validation : quick and easy!

and by itself it works well

but also I am using jQuery with forms and it seems to be over riding the validation and just processing the form anyway

Q: How do I set it up so jQuery form can wait for validation to work 1st?

Thanks in advance

Views

658

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 01, 2015 Nov 01, 2015

Is there some reason you can't use HTML5 form validation?

A Simple HTML5 Form Validation - JSFiddle

Nancy O.

Votes

Translate

Translate
Community Expert ,
Oct 23, 2015 Oct 23, 2015

Copy link to clipboard

Copied

I prefer to put validation into my server-side form-processing script.

Client side validation is not foolproof.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 25, 2015 Oct 25, 2015

Copy link to clipboard

Copied

Hi Nancy,


Agreed, however right now I would like to know how to make this work for my current project


Here is the code from here ...


http://www.javascript-coder.com/html-form/javascript-form-validation.phtml

Now I just need to figure out how to = add post code AFTER the form has successfully validated.

my laymen version...

1 - test here

2 - if success....

alert ("success");

then add more code like... $.post('https://mysite.com/test.php', { password: pass, ...... etc.

3 - if fail - then

alert ("fail");

Any idea how to set this up with this code from this site?

<!DOCTYPE html>

<html>

<head>

<title>test</title>

<style type="text/css" xml:space="preserve">

BODY, P,TD{ font-family: Arial,Verdana,Helvetica, sans-serif; font-size: 10pt }

A{font-family: Arial,Verdana,Helvetica, sans-serif;}

B { font-family : Arial, Helvetica, sans-serif; font-size : 12px; font-weight : bold;}

.error_strings{ font-family:Verdana; font-size:14px; color:#F00; }

</style>

<script src="gen_validatorv4.js" type="text/javascript" >

</script>

</head>

<body>

<form action="" method="POST" id="nowform">

<div class="box1 center1">

<p>enter PASSWORD<br>

<div id='nowform_pass_errorloc' class="error_strings"></div>

<input id="pass" name="pass" type="password" size="15" class="print_data_22" />

</p>

<input type="submit"  />

</form>

<script>

alert ("test1");

var frmvalidator = new Validator("nowform");

frmvalidator.EnableOnPageErrorDisplay();

frmvalidator.EnableMsgsTogether();

frmvalidator.addValidation("pass","req","Please enter your pass");

frmvalidator.addValidation("pass","maxlen=15", "Max length for pass is 15");

alert ("test2");

//start post code... WHERE DO I PUT THIS POST CODE?

$.post('http://mysite.com/getstuff.php', { ... etc...

</script>

</body>

</html>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 01, 2015 Nov 01, 2015

Copy link to clipboard

Copied

Is there some reason you can't use HTML5 form validation?

A Simple HTML5 Form Validation - JSFiddle

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 24, 2015 Dec 24, 2015

Copy link to clipboard

Copied

LATEST

Hi Nancy,

I WOULD LIKE TO THANK YOU FOR ALL YOUR FABULOUS KIND ASSISTANCE - it really helped me SOOOO MUCH!!

HAPPY HOLIDAYS!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines