Jump to content
  • 0
Sign in to follow this  
Jess147

Multi Select Listbox

Question

3 answers to this question

Recommended Posts

  • 0

Hello @Jess147,

 

The way Caspio setup their custom element for List-Strings seems more complicated that it looks.

You may try adding this poorly-written code to your footer to limit the selections on your Submission Form.

Currently, it only works on Multi-Select Listbox. I'll try to get back to this thread another time so we can implement a better solution and add support to Multi-Select Dropdown, as well as other types of DataPages.

 

Cheers!

DN31337

 

<script>

setTimeout(function() {

var fieldName = 'ls'; //replace with your actual field name
var cbs = document.querySelectorAll(`[id*=InsertRecord${fieldName}] .Item`)

cbs.forEach(function(elem) {
  elem.addEventListener('click', function(e) {
    setTimeout(function() {

      var counter = document.querySelectorAll(`[id*=InsertRecord${fieldName}] .Item [type=checkbox]:checked`).length;
      console.log(e.target, counter)

      if(counter > 2) { //replace with the limit you wish
        e.target.click();
      }
      
    }, 333);
  });
  
});

console.log('deChecker ready!');

}, 1500)

</script>

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...