Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Delisle <marc@infomarc.info>2015-04-05 23:57:29 +0300
committerMarc Delisle <marc@infomarc.info>2015-04-05 23:57:29 +0300
commit285d7cd594c94faf143991a1e79539f5e187c573 (patch)
tree5e125fee50fa9ae1b1e4808bca5903a67ba00571 /js/tbl_change.js
parentba1243c8eb5c1be24f57c0afc8a95fb1f8026e88 (diff)
parent053ca6029e2a757b4a686898c8fe4931f50239aa (diff)
Merge pull request #1633 from whitepiegon/masterFeature2
additional feature for form validation
Diffstat (limited to 'js/tbl_change.js')
-rw-r--r--js/tbl_change.js69
1 files changed, 59 insertions, 10 deletions
diff --git a/js/tbl_change.js b/js/tbl_change.js
index c702d4632a..15485a7d76 100644
--- a/js/tbl_change.js
+++ b/js/tbl_change.js
@@ -182,7 +182,12 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|| target.value === 'AES_ENCRYPT'
|| target.value === 'MD5') {
$('#' + target.id).rules("add", {
- validationFunctionForFuns : $this_input
+ validationFunctionForFuns: {
+ param: $this_input,
+ depends: function() {
+ return checkForCheckbox(multi_edit);
+ }
+ }
});
}
@@ -207,36 +212,80 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
// validate for date time
if (theType == "datetime" || theType == "time" || theType == "date" || theType == "timestamp") {
$this_input.rules("add", {
- validationFunctionForDateTime : theType
+ validationFunctionForDateTime: {
+ param: theType,
+ depends: function() {
+ return checkForCheckbox(multi_edit);
+ }
+ }
});
}
//validation for integer type
if ($this_input.data('type') === 'INT') {
- var min = $this_input.attr('min');
- var max = $this_input.attr('max');
+ var mini = parseInt($this_input.attr('min'));
+ var maxi = parseInt($this_input.attr('max'));
$this_input.rules("add", {
- maxlength : max,
- minlength : min
+ number: {
+ param : true,
+ depends: function() {
+ return checkForCheckbox(multi_edit);
+ }
+ },
+ min: {
+ param: mini,
+ depends: function() {
+ if (isNaN($this_input.val())) return false;
+ else return checkForCheckbox(multi_edit);
+ }
+ },
+ max: {
+ param: maxi,
+ depends: function() {
+ if (isNaN($this_input.val())) return false;
+ else return checkForCheckbox(multi_edit);
+ }
+ }
});
//validation for CHAR types
} else if ($this_input.data('type') === 'CHAR') {
var maxlen = $this_input.data('maxlength');
if (maxlen <=4) {
- maxlen=charExceptionHandling
+ maxlen=charExceptionHandling;
}
$this_input.rules("add", {
- maxlength : maxlen
+ maxlength: {
+ param: maxlen,
+ depends: function() {
+ return checkForCheckbox(multi_edit);
+ }
+ }
});
// validate binary & blob types
} else if ($this_input.data('type') === 'HEX') {
$this_input.rules("add", {
- validationFunctionForHex : true
+ validationFunctionForHex: {
+ param: true,
+ depends: function() {
+ return checkForCheckbox(multi_edit);
+ }
+ }
});
}
if (removeOnclick === 1) $this_input.removeAttr('onchange');
}
}
- /* End of fields validation*/
+/* End of fields validation*/
+
+/**
+ * To check whether insert section is ignored or not
+ */
+function checkForCheckbox(multi_edit)
+{
+ if($("#insert_ignore_"+multi_edit).length) {
+ return $("#insert_ignore_"+multi_edit).is(":unchecked");
+ }
+ return true;
+}
/**
* Applies the selected function to all rows to be inserted.