Elena Posted November 20, 2014 Report Share Posted November 20, 2014 Hi, Is there a way to put a limit to the number of items that can be selected in a list box? I have a list box in an update form. It is not for search purposes, rather for adding values to a data base. Any help or attention will be greatly appreciated. Best, Elena Quote Link to comment Share on other sites More sharing options...
0 Jan Posted November 25, 2014 Report Share Posted November 25, 2014 Hi Elena, I think, you can use the following script, if it works for you: function check_listbox() { var the_listbox = document.getElementById("EditRecordFIELDNAME"); var max_number = 3; var checked = 0; for (var i=0 ; i < the_listbox.options.length; i++ ) { if (the_listbox.options[i].selected) {checked++;} if (checked > max_number) { alert("The maximum of choices is 3!"); return false; } } } document.getElementById("caspioform").onsubmit = check_listbox; Please, enter the name of your field instead of FIELDNAME; enter your maximum number and your message. The script will not allow to save the record, if a user selects too many items. I hope, it helps. Quote Link to comment Share on other sites More sharing options...
Question
Elena
Hi,
Is there a way to put a limit to the number of items that can be selected in a list box?
I have a list box in an update form. It is not for search purposes, rather for adding values to a data base.
Any help or attention will be greatly appreciated.
Best,
Elena
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
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.