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.
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: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 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();
}