xXREDXIIIXx Posted September 18, 2010 Share Posted September 18, 2010 Ok so I have started to upgrade my site to HTML5 just having an issue with a validater This is the validation line basically i need to get it to submit the data without reloading the page $("#form").validator(); This is the code i currently have: the validater works but it wont posts and it refreshes / code all works prior to adding validater <form name="form" id="form" method="post" action=""> <input name="id" id="id" type="hidden" value="<? echo $gameid; ?>"> <input name="title" id="title" type="hidden" value="<? echo $ntitle; ?>"> <input type="url" required="required" pattern="^https?://(?:[a-z\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:jpe?g|gif|png)$" name="iconurl" id="iconurl" class="form_field" style="width: 300px;" value="Icon URL" onFocus="if(value=='Icon URL')value=''" onBlur="if(value=='')value='Icon URL'; urlCheck(this.value);"> <input type="text" required="required" name="atitle" id="atitle" class="form_field" style="width: 300px;" value="Title" onFocus="if(value=='Title')value=''" onBlur="if(value=='')value='Title'"> <input type="textarea" required="required" name="adescription" id="adescription" class="form_field" style="width: 300px;" value="Description" onFocus="if(value=='Description')value=''" onBlur="if(value=='')value='Description'"> <button type="submit" class="form_field_btn" name="save" id="save">Save</button> </form> $.tools.validator.localize("fi", { '*' : 'Correct this value.', ':email' : 'Invalid E-mail.', ':number' : 'Numeric value only', ':url' : 'Invalid URL', '[max]' : 'Maximum value: $1', '[min]' : 'Minimum value: $l', '[required]' : 'This filed is required.' }); $("#form").validator(function(){ lang: 'fi'; $.post('http://www.domain.com/file.php', $("#form").serialize(), function(data){ $("#").slideToggle("slow"); $("#").slideToggle("fast"); $('#').html(data); }); }); Quote Link to comment https://forums.phpfreaks.com/topic/213765-html5-jquery-validation-no-page-reloads/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.