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

BPS Git Server git at git.bestpractical.com
Tue Nov 14 20:23:20 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  1cab2e2a139638b8e54d0674a6a5ccab93073f90 (commit)
      from  67fb2ac26029c1b57fe30ee1d131f4c0bc9d3bd2 (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 1cab2e2a139638b8e54d0674a6a5ccab93073f90
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 14 15:13:57 2023 -0500

    Fix the logic to not automatically select the first valid option for selects
    
    Previously we used ".val()" to check if the select has selected options,
    which happened after the empty option was deleted, at which time browsers
    already selected the next option and ".val()" returned that option.
    
    This commit fixed it by checking option's "selected" attribute instead.

diff --git a/html/Forms/dhandler b/html/Forms/dhandler
index 82c0995..831b6ef 100644
--- a/html/Forms/dhandler
+++ b/html/Forms/dhandler
@@ -57,7 +57,7 @@ jQuery(function () {
 
             if ( elem.find('select.selectpicker').length ) {
                 elem.find('select.selectpicker option[value=""]').remove();
-                if ( !elem.find('select.selectpicker').val() ) {
+                if ( !elem.find('select.selectpicker option[selected]').length ) {
                     elem.find('select.selectpicker').val(null); // Do not automatically select the first valid option
                 }
                 elem.find('select.selectpicker').attr('required', true);

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

Summary of changes:
 html/Forms/dhandler | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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


More information about the Bps-public-commit mailing list