html5 - HTML 5 native validation is not working in JQuery UI model box but Jquery validation using plugin is working -
i using jquery model box html 5 native validation not working.
my code here
also adding code below.
<!doctype html> <html> <head> <title>jquery ui dialog: open dialog </title> <link rel="stylesheet" href="../css/jquery-ui.css" /> <link rel="stylesheet" href="../css/style.css" /> <script type="text/javascript" src="../scripts/jquery.js"></script> <script type="text/javascript" src="../scripts/jquery-ui.js"></script> <script type="text/javascript" src="../scripts/jquery.validate.js"></script> <script type="text/javascript"> $(function(){ //$('#pop_up_form').validate(); $("#popup").dialog({ autoopen: true, title : "view/edit screen", dialogclass : "pop-content pop-header-colr pop-button pop-float", width:400, height:450, modal: true, resizable: false, show: 'clip', buttons:{ 'submit':function(){ /*if($('#pop_up_form').valid()) { alert("successfull"); }*/ } } }); }); </script> </head> <body> <div id="popup" style="display:none"> <form action="" name="pop_up_form" id="pop_up_form" method="post"><input class="pop_up_textbox" type="text" name="acct_nmbr" id="acct_nmbr" required maxlength="19" value=""/></form> </div> </body> </html>
here if un-commenting jquery code commented , can see jquery validation working fine. why html5 validation not working here if commenting jquery validation code. test html 5 validation have added attribute "required" form field , how not working.
i know html 5 doctype should !doctype html
. have added no luck. because of ui dialog box doesnt support html 5 native validation.
it happening because modal box's button doesn't trigger html5 validation.
you cannot use use both html5 , jquery validations. if want go html5 validation while still using jquery, can submit()
in situation let call html5 validation.
function(){ $('#pop_up_form .submit').click(); return false; }
for work, need have hidden input in form html
<input type="submit" class="submit" style="display:none;"></input>
fiddle
i still see people using browsers don't support html5, may want re-think this.
Comments
Post a Comment