Hi,
I'm looking for a sollution to check the things filled in on my subform.
When the user select p.ex. item with code '100' (whith the lookup) he also need to select item '110'
I want to get an alert before safe when item 100 is selected but item 110 is missing.
How to get it work?
Thanks
Johan
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
nubeforeSave or other function?
-
- Posts: 392
- Joined: Sun Feb 27, 2011 11:16 am
- Location: Belgium
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: nubeforeSave or other function?
johan,
I haven't tested it but this should work for you..
Steven
I haven't tested it but this should work for you..
Code: Select all
function nuBeforeSave(){
if(hasValue('100') && !hasValue('110')){
alert('110 needs to be added');
return false;
}else{
return true;
}
}
function hasValue(pCode){
var sfName = 'thesubform'; //-- the subform name to look in
var fdName = 'thefield'; //-- the field name to look in
var ar = Array();
ar = nuSubformRowArray('FMinvoice_item');
for(var i = 0 ; i < ar.length ; i++){
if(document.getElementById(ar[i] + fdname).value == pCode){
return true;
}
}
return false;
}
Steven
-
- Posts: 392
- Joined: Sun Feb 27, 2011 11:16 am
- Location: Belgium