From ced28ddd59e39e9aa22a2c80b478b9a3934a7774 Mon Sep 17 00:00:00 2001
From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com>
Date: Tue, 16 Jan 2018 23:14:21 -0500
Subject: [PATCH] Improvement to settings form validation #39
---
views/settings.tpl | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/views/settings.tpl b/views/settings.tpl
index 6dcb3a8b1..d1f842175 100644
--- a/views/settings.tpl
+++ b/views/settings.tpl
@@ -39,6 +39,9 @@
@@ -462,12 +465,12 @@
%end
@@ -529,7 +532,7 @@
.tab()
;
- $('a:not(.tabs), button:not(.cancel, .submit)').click(function(){
+ $('a:not(.tabs), button:not(.cancel)').click(function(){
$('#loader').addClass('active');
})
@@ -583,9 +586,16 @@
},
inline : true,
on : 'blur',
+ onValid: function(){
+ $('#form_validation_error').hide();
+ $('.submit').removeClass('disabled');
+ },
+ onInvalid: function(){
+ $('#form_validation_error').show();
+ $('.submit').addClass('disabled');
+ },
onFailure: function(){
return false;
- alert('Some fields are in error');
},
onSuccess: function(){
$('#loader').addClass('active');
@@ -599,4 +609,13 @@
$('#settings_languages').dropdown('setting', 'onChange', function(){
$('.form').form('validate field', 'settings_subliminal_languages');
});
+
+ $('.submit').click(function() {
+ alert('Settings saved.');
+ })
+
+ $( document ).ready(function() {
+ $('.form').form('validate form');
+ $('#loader').removeClass('active');
+ });
\ No newline at end of file