Hi,
I have a mulit-select object with 4 options. If I click and drag I can select adjacent items. But if I try to click separately on non-adjacent items, it de-selects the first one. I'm considering just creating new fields for each item and using check boxes instead. But the multi-select would make it easier to add or change items later on.
Thanks!
Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
can't mulitselect non-adjacent items
-
- nuBuilder Team
- Posts: 4566
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 times
- Contact:
-
- Posts: 49
- Joined: Wed Aug 26, 2020 10:38 pm
Re: can't mulitselect non-adjacent items
I know that would work but I'm building this app for people that probably wouldn't know that trick so I was hoping to keep it simple.
-
- nuBuilder Team
- Posts: 4566
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 times
- Contact:
Re: can't mulitselect non-adjacent items
Add this JavaScript to your form's custom code. Replace your_select_id with the Object ID of your select object.
Code: Select all
if (nuFormType() == 'edit') {
your_select_id.onmousedown = function (event) {
if (event.shiftKey) return;
event.preventDefault();
this.focus();
var scroll = this.scrollTop;
event.target.selected = !event.target.selected;
this.scrollTop = scroll;
this.dispatchEvent(new Event("change"));
}
}
-
- nuBuilder Team
- Posts: 4566
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 times
- Contact:
Re: can't mulitselect non-adjacent items
Or use this code, if there is more than 1 multi select:
https://github.com/smalos/nuBuilder4-Co ... t_ctrl_key
https://github.com/smalos/nuBuilder4-Co ... t_ctrl_key
Last edited by kev1n on Fri Sep 04, 2020 5:39 pm, edited 1 time in total.
-
- Posts: 49
- Joined: Wed Aug 26, 2020 10:38 pm