Jump to content

HTML5 Jquery validation No page reloads


xXREDXIIIXx

Recommended Posts

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);
  });
});

Link to comment
https://forums.phpfreaks.com/topic/213765-html5-jquery-validation-no-page-reloads/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.