Hi all,
I'm trying to call a function within a function, which I can do if I don't need it to return false. But I need it to return false (if it is)...how? I want to have this search.js file to be "re-usable" by two different search pages:
Any ideas?
Thanks!
I'm trying to call a function within a function, which I can do if I don't need it to return false. But I need it to return false (if it is)...how? I want to have this search.js file to be "re-usable" by two different search pages:
Code:
//*********************************
//**** INITIAL SEARCH CRITERIA ****
//*********************************
function initialSearch(sCat) {
if (sCat == "_") {
alert("some alert.");
search.sCat.focus();
return false;
}
return true;
}
//*******************************
//**** BASIC SEARCH CRITERIA ****
//this is called from search page 1
//*******************************
function searchBasic() {
var sCat = search.sCat.value;
initialSearch(sCat); //if initial check is false...don't go into code below (right now it does)
if (search.sVar1.value=="_") {
alert("some alert");
search.sVar1.focus();
return false;
}
if (search.sVar2.value=="_") {
alert("some alert.");
search.sVar2.focus();
return false;
}
return true;
}
//***********************************
//**** ADVANCED SEARCH CRITERIA ****
//this is called from search page 2.
//***********************************
//work in progress...
function searchAdvanced() {
return initialSearch();
searchBasic(); //re-use basic logic if any in basic logic fails...return false out of all code.
//more complex checking in the works...
return true;
}
Any ideas?
Thanks!