Saturday, 15 September 2012

JavaScript Validation working on Firefox but not Chrome -



JavaScript Validation working on Firefox but not Chrome -

i upset, have been spending hours on this. can guys tell me whats wrong? tried onsubmit @ origin @ end of form. changed onchange , onclick still same issue.

i cant submit button give thanks message if write onclick function because disables onsubmit

<script type="text/javascript"> <!-- // form validation code come here. function validate() { if( document.myform.name.value == "" ) { alert( "please provide name!" ); document.myform.name.focus() ; homecoming false; } if( document.myform.email.value == "" ) { alert( "please provide email!" ); document.myform.email.focus() ; homecoming false; } if( document.myform.phone.value == "" || isnan( document.myform.phone.value ) || document.myform.phone.value.length != 5 ) { alert( "please provide phone number can reach you." ); document.myform.phone.focus() ; homecoming false; } return( true ); } //--> </script> <div class="iphorm-outer"> <form class="iphorm" action="send_contact.php" name="myform" method="post" > <div class="iphorm-wrapper"> <div class="iphorm-inner"> <div class="iphorm-message"></div> <div class="iphorm-container clearfix"> <!-- begin name element --> <div class="element-wrapper name-element-wrapper clearfix"> <label for="name">name <span class="required">(required)</span></label> <div class="input-wrapper name-input-wrapper"> <input class="name-element" id="name" type="text" name="name" /> </div> </div> <!-- end name element --> <!-- begin email element --> <div class="element-wrapper email-element-wrapper clearfix"> <label for="email">email <span class="required">(required)</span></label> <div class="input-wrapper email-input-wrapper"> <input class="email-element" id="email" type="text" name="email" /> </div> </div> <!-- end email element --> <!-- begin phone element --> <div class="element-wrapper phone-element-wrapper clearfix"> <label for="phone">phone</label> <div class="input-wrapper phone-input-wrapper"> <input class="phone-element" id="phone" type="text" name="phone" /> </div> </div> <!-- end phone element --> <!-- begin message element --> <div class="element-wrapper message-element-wrapper clearfix"> <label for="message">message <span class="required">(required)</span></label> <div class="input-wrapper message-input-wrapper clearfix"> <textarea class="message-element" id="message" name="message" rows="7" cols="45"></textarea> </div> </div> <!-- end message element --> <!-- begin submit button --> <div class="button-wrapper submit-button-wrapper clearfix"> <div class="loading-wrapper"><span class="loading">thank you, message sent.</span></div> <div class="button-input-wrapper submit-button-input-wrapper"> <input class="ka-form-submit" type="submit" name="contact" onclick="return(validate())" value="submit"/> </div> </div> <!-- end submit button --> </div> </div> </div> </form>

can please help me write function disable submit button unless function validate true?

everything seems fine. seek refresh page using ctrl + f5 clear browser's cache.

javascript google-chrome firefox cross-browser

No comments:

Post a Comment