T
theroo
I am (attempting to) build a very flexible js routine which passes
information from a form to a new page.
The form is built up from a database and so the names of each
form-field are variables themselves.
eg:
name=sDependantdCode_<%=rsSections(0)%>
name=sDependantoCode_<%=rsSections(0)%>
I have onClick events which fire for each these two form-fields:
onClick="showDetails(<%=rsSections(0)%>)"
onClick="showOptions(<%=rsSections(0)%>)"
The first one works fine, but the problem I am having is I want
a. to be able to test if the 'dCode' form field has something in when
you try to select the 'oCode' field.
b. to pass the 'dCode' value into the window.open method which fires
for the 'oCode' field.
The code I have is:
function showOptions(i) {
// declare variable
var tbm;
var sKey;
var dCode;
// assign field name to variable
// based on argument
tbm='frmES.sDependantoCode_'+i;
sKey=<%=sKey%>;
if (frmES.sDependantdCode_+i.value <> '') {
dCode = frmES.sDependantdCode_+i.value;
// call pop up calendar
// passing field name variable
window.open('popup_options.asp?tbm='+tbm+'&sKey='+sKey+'&i='+i+'&dCode='+dCode,'ncal','width=220,height=220');
}
}
The main question is, how do I get the variable 'i' appended to the
form-field definition 'frmES.sDependantdCode_' so that it knows it is a
form definition and can test whether it exists or not.
I appreciate any and all help on this.
Many Thanks
Andrew
information from a form to a new page.
The form is built up from a database and so the names of each
form-field are variables themselves.
eg:
name=sDependantdCode_<%=rsSections(0)%>
name=sDependantoCode_<%=rsSections(0)%>
I have onClick events which fire for each these two form-fields:
onClick="showDetails(<%=rsSections(0)%>)"
onClick="showOptions(<%=rsSections(0)%>)"
The first one works fine, but the problem I am having is I want
a. to be able to test if the 'dCode' form field has something in when
you try to select the 'oCode' field.
b. to pass the 'dCode' value into the window.open method which fires
for the 'oCode' field.
The code I have is:
function showOptions(i) {
// declare variable
var tbm;
var sKey;
var dCode;
// assign field name to variable
// based on argument
tbm='frmES.sDependantoCode_'+i;
sKey=<%=sKey%>;
if (frmES.sDependantdCode_+i.value <> '') {
dCode = frmES.sDependantdCode_+i.value;
// call pop up calendar
// passing field name variable
window.open('popup_options.asp?tbm='+tbm+'&sKey='+sKey+'&i='+i+'&dCode='+dCode,'ncal','width=220,height=220');
}
}
The main question is, how do I get the variable 'i' appended to the
form-field definition 'frmES.sDependantdCode_' so that it knows it is a
form definition and can test whether it exists or not.
I appreciate any and all help on this.
Many Thanks
Andrew