html - javascript form validate not preventing css .submitted from actioning -


i have form class="myfrm" , contains fieldset made of input fields. after fieldset tag have div tag , assigned class="ack-msg" contains acknowledgement message.

in css have

.myfrm.submitted fieldset {     display: none; } .myfrm.submitted .ack-msg {     display: block; } 

when form submitted fieldset replaced acknowledgement. works fine when form completed expected when form validation fails message displayed acknowldgement class="ack-msg" kicks in , replaces fieldset if passed.

the validation carried out javascript function called onsubmit on form. javascript listed below , keep things simple have shorted version of script passes validation if provided parameter value = 24.

function validateform(v)  {   if(v.value != '24')   {      alert("oops! try agan!");     return false;   } else {      return true;   } } 

also, if inspect page after validation fails , acknowledgement gets diaplayed form declaration has been updated class="my-frm" class="my-frm submitted"

if should listing other details please let me know.

any welcome on this.

thanks in advance, ned

try remove submitted class using javascript, right after alert. if have jquery:

function validateform(v)  {     if(v.value != '24')     {          alert("oops! try agan!");         $.(".my-frm").removeclass("submitted");         return false;     } else {          return true;     } } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -