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.
eliminate redundant choices in lookup list
-
- Posts: 2
- Joined: Mon Nov 26, 2012 1:46 am
eliminate redundant choices in lookup list
I refer to the popular Invoice with subform allowing multiple invoice line items to be populated by lookup and selecting a product code. Every time a new invoice line item is added, the lookup list will contain all products, including those that were on the saved invoice already. Is there a way to limit the lookup to only those products that are not currently saved in the db as line item of that particular invoice?
Re: eliminate redundant choices in lookup list
lightkong,
There are times you need the same thing twice..
Steven
There are times you need the same thing twice..
Steven
You do not have the required permissions to view the files attached to this post.
-
- Posts: 2
- Joined: Mon Nov 26, 2012 1:46 am
Re: eliminate redundant choices in lookup list
I understand that. But for some cases we need to limit the list to only those items not yet selected.
Is this possible at all? Or perhaps lookup is not the right object for such requirement, or some other way...?
Is this possible at all? Or perhaps lookup is not the right object for such requirement, or some other way...?
Re: eliminate redundant choices in lookup list
lightkong,
The best answer I can give you is add (something like) this JavaScript to your form..
Steven
The best answer I can give you is add (something like) this JavaScript to your form..
Code: Select all
function nuBeforeSave(){
if (isDuplicate()){
return false;
}
return true;
}
function isDuplicate(){
var ar = Array();
var used = Array();
ar = nuSubformRowArray('FMinvoice_item');
for(var i = 0 ; i < ar.length ; i++){
var id = '#code' + ar[i] + 'tri_product_id';
if(used.indexOf($(id).val()) == -1){
used[used.length] = $(id).val();
}else{
alert($(id).val() + ' on line ' + (i+1-0) + ' has already been used');
return false;
}
}
return true;
}