[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-77-g46a90db

BPS Git Server git at git.bestpractical.com
Tue Oct 31 13:53:31 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-formtools".

The branch, dynamic-forms-from-config has been updated
       via  46a90dbd31df32ee385a3e66af91e6c888b0b58c (commit)
       via  449967ae03d820d79457671d2f4a1150ae9f16fe (commit)
      from  d60818847d08468f88eaca18b43866d1eb14dcbd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 46a90dbd31df32ee385a3e66af91e6c888b0b58c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Oct 31 09:50:10 2023 -0400

    Make placeholders lighter so it's clear that they are placeholders

diff --git a/static/css/rt-extension-formtools.css b/static/css/rt-extension-formtools.css
index 4e6f8ff..6c42b76 100644
--- a/static/css/rt-extension-formtools.css
+++ b/static/css/rt-extension-formtools.css
@@ -76,3 +76,7 @@ div .formtools-admin-description {
 #formtools-form-body p {
     text-align: center;
 }
+
+.formtools-form-pages input::placeholder {
+    opacity: 0.5;
+}

commit 449967ae03d820d79457671d2f4a1150ae9f16fe
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Oct 31 09:28:07 2023 -0400

    Automatically validate content to indicate errors in real time

diff --git a/html/Admin/FormTools/Advanced.html b/html/Admin/FormTools/Advanced.html
index a6e520f..8a64fb6 100644
--- a/html/Admin/FormTools/Advanced.html
+++ b/html/Admin/FormTools/Advanced.html
@@ -11,6 +11,12 @@
     <textarea class="form-control" rows="30" name="Content"><% $ARGS{Content} || $encoded_content %></textarea>
   </&>
 
+  <div class="form-row invalid-json hidden">
+    <div class="offset-3 col-9">
+      <div class="alert alert-danger mb-0"><&|/l&>Invalid JSON</&></div>
+    </div>
+  </div>
+
   <div class="form-row">
     <div class="col-12">
       <& /Elements/Submit, Label => loc('Save Changes'), Name => 'Update' &>
@@ -19,6 +25,28 @@
 
 </form>
 
+<script type="text/javascript">
+jQuery('form[name=ModifyFormToolsAdvanced] :input[name=Content]').bind('input propertychange', function() {
+    var form = jQuery(this).closest('form');
+    var validate_json = function (str) {
+        try {
+            JSON.parse(str);
+        } catch (e) {
+            return false;
+        }
+        return true;
+    };
+    if ( validate_json(jQuery(this).val()) ) {
+        form.find('input[type=submit]').prop('disabled', false);
+        form.find('.invalid-json').addClass('hidden');
+    }
+    else {
+        form.find('input[type=submit]').prop('disabled', true);
+        form.find('.invalid-json').removeClass('hidden');
+    }
+});
+</script>
+
 <%INIT>
 Abort("No form id found") unless $id;
 

-----------------------------------------------------------------------

Summary of changes:
 html/Admin/FormTools/Advanced.html    | 28 ++++++++++++++++++++++++++++
 static/css/rt-extension-formtools.css |  4 ++++
 2 files changed, 32 insertions(+)


hooks/post-receive
-- 
rt-extension-formtools


More information about the Bps-public-commit mailing list