Skip to content

Commit 53a0ac0

Browse files
author
Olivier Refalo
committed
Merge pull request posabsolute#346 from peyote/master
ajaxFormValidationMethod param added
2 parents 0e49b62 + e2cf152 commit 53a0ac0

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ Form validation takes place when the validate() action is called or when the for
274274
### ajaxFormValidationURL
275275
If set, the ajax submit validation will use this url instead of the form action
276276

277+
### ajaxFormValidationMethod
278+
HTTP method used for ajax validation, defaults to 'get', can be set to 'post'
279+
277280
### onBeforeAjaxFormValidation(form, options)
278281
When ajaxFormValidation is turned on, this is the function that will be called before the asynchronous AJAX form validation call. May return false to stop the Ajax form validation
279282

demos/demoAjaxSubmitPHP.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
jQuery(document).ready(function(){
4040
jQuery("#formID").validationEngine({
4141
ajaxFormValidation: true,
42-
onAjaxFormComplete: ajaxValidationCallback,
42+
ajaxFormValidationMethod: 'post',
43+
onAjaxFormComplete: ajaxValidationCallback
4344
});
4445
});
4546
</script>

demos/phpajax/ajaxValidateFieldName.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

33
/* RECEIVE VALUE */
4-
$validateValue=$_GET['fieldValue'];
5-
$validateId=$_GET['fieldId'];
4+
$validateValue=$_REQUEST['fieldValue'];
5+
$validateId=$_REQUEST['fieldId'];
66

77

88
$validateError= "This username is already taken";

demos/phpajax/ajaxValidateFieldUser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

33
/* RECEIVE VALUE */
4-
$validateValue=$_GET['fieldValue'];
5-
$validateId=$_GET['fieldId'];
4+
$validateValue=$_REQUEST['fieldValue'];
5+
$validateId=$_REQUEST['fieldId'];
66

77

88
$validateError= "This username is already taken";

demos/phpajax/ajaxValidateSubmit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

33
/* RECEIVE VALUE */
4-
$nameValue=$_GET['firstname'];
5-
$userValue=$_GET['user'];
4+
$nameValue=$_REQUEST['firstname'];
5+
$userValue=$_REQUEST['user'];
66

77

88
$validateError= "This username is already taken";

js/jquery.validationEngine.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@
366366
var data = form.serialize();
367367
var url = (options.ajaxFormValidationURL) ? options.ajaxFormValidationURL : form.attr("action");
368368
$.ajax({
369-
type: "GET",
369+
type: options.ajaxFormValidationMethod,
370370
url: url,
371371
cache: false,
372372
dataType: "json",
@@ -1046,7 +1046,7 @@
10461046

10471047
if (!options.isError) {
10481048
$.ajax({
1049-
type: "GET",
1049+
type: options.ajaxFormValidationMethod,
10501050
url: rule.url,
10511051
cache: false,
10521052
dataType: "json",
@@ -1558,10 +1558,12 @@
15581558
inlineAjax: false,
15591559
// if set to true, the form data is sent asynchronously via ajax to the form.action url (get)
15601560
ajaxFormValidation: false,
1561+
// The url to send the submit ajax validation (default to action)
1562+
ajaxFormValidationURL: false,
1563+
// HTTP method used for ajax validation
1564+
ajaxFormValidationMethod: 'get',
15611565
// Ajax form validation callback method: boolean onComplete(form, status, errors, options)
15621566
// retuns false if the form.submit event needs to be canceled.
1563-
ajaxFormValidationURL: false,
1564-
// The url to send the submit ajax validation (default to action)
15651567
onAjaxFormComplete: $.noop,
15661568
// called right before the ajax call, may return false to cancel
15671569
onBeforeAjaxFormValidation: $.noop,

0 commit comments

Comments
 (0)