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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.