Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Select object, exclude certain items for new records
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm
Select object, exclude certain items for new records
My select field contains values (years) like 2019, 2018, 2017. For new records, the previous years should be excluded (2018, 2017) and only the current year should be in the drop down list. How can I do that?
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Select object, exclude certain items for new records
Replace your_select_id with your select object id, add this code to the form's js field:
Code: Select all
if(nuIsNewRecord()) {
var currentYear = new Date().getFullYear();
$('#your_select_id option').filter(function () {
return parseInt(this.value) < currentYear;
}).remove();
}