amethystct
Programmer
Hi!
I have a function that WAS working beautifully. I have a page that displays some query rows for me. I had a form for each row but it had to be changed when other form input was added. Now instead of the form being on each row it's just one form. I hope this makes sense!
What's happening is the document.forms[index] is now null. Can I get the whole array of values for the checkbox and see which one the user checked instead?
Here's the function:
function showInfo (infoObj){
alert("In showinfo:" + infoObj);
if (infoObj.checked) {
alert("In showInfo. Box is checked"
var rowIndex = infoObj.name;
alert("Row index: " + rowIndex);
alert("test2: " + document.forms[rowIndex]);
var custCode = document.forms[rowIndex].custcode.value;
custCode = custCode.replace(/\W+$/,'');
alert("cust: " + custCode);
var aoms = document.forms[rowIndex].aoms.value;
aoms = aoms.replace(/\W+$/,'');
alert("aoms: " + aoms);
var contract = document.forms[rowIndex].contract.value;
contract = contract.replace(/\W+$/,'');
alert("contract: " + contract);
var custpo = document.forms[rowIndex].custpo.value;
custpo = custpo.replace(/\W+$/,'');
alert("Po: " + custpo);
var partnum = document.forms[rowIndex].partnum.value;
partnum = partnum.replace(/\W+$/,'');
alert("part: " + partnum);
var ordernum = document.forms[rowIndex].ordernum.value;
ordernum = ordernum.replace(/\W+$/,'');
alert("ordernum: " + ordernum);
var windowwidth = 800, topheight = 600, bottomheight = 10; // default sizes
if (window.screen) {
windowwidth = window.screen.availWidth-10;
topheight = (window.screen.availHeight * 60 / 100) - 10;
bottomheight = (window.screen.availHeight * 40 / 100) - 20;
}
alert("set window"
var UHJ = 'contractInfo.jhtml?orderNum=' + ordernum + '&custCode=' + custCode + '&AOMS=' + aoms + '&CUSTPO=' + custpo;
infoObj.checked = false;
alert("set page info and reset box to false"
window.open(UHJ,'test','scrollbars=yes');
}
}
called:
<INPUT TYPE="checkbox" NAME="param:index" VALUE="moreInfo" onClick="showInfo(this);">
I have a function that WAS working beautifully. I have a page that displays some query rows for me. I had a form for each row but it had to be changed when other form input was added. Now instead of the form being on each row it's just one form. I hope this makes sense!
What's happening is the document.forms[index] is now null. Can I get the whole array of values for the checkbox and see which one the user checked instead?
Here's the function:
function showInfo (infoObj){
alert("In showinfo:" + infoObj);
if (infoObj.checked) {
alert("In showInfo. Box is checked"
var rowIndex = infoObj.name;
alert("Row index: " + rowIndex);
alert("test2: " + document.forms[rowIndex]);
var custCode = document.forms[rowIndex].custcode.value;
custCode = custCode.replace(/\W+$/,'');
alert("cust: " + custCode);
var aoms = document.forms[rowIndex].aoms.value;
aoms = aoms.replace(/\W+$/,'');
alert("aoms: " + aoms);
var contract = document.forms[rowIndex].contract.value;
contract = contract.replace(/\W+$/,'');
alert("contract: " + contract);
var custpo = document.forms[rowIndex].custpo.value;
custpo = custpo.replace(/\W+$/,'');
alert("Po: " + custpo);
var partnum = document.forms[rowIndex].partnum.value;
partnum = partnum.replace(/\W+$/,'');
alert("part: " + partnum);
var ordernum = document.forms[rowIndex].ordernum.value;
ordernum = ordernum.replace(/\W+$/,'');
alert("ordernum: " + ordernum);
var windowwidth = 800, topheight = 600, bottomheight = 10; // default sizes
if (window.screen) {
windowwidth = window.screen.availWidth-10;
topheight = (window.screen.availHeight * 60 / 100) - 10;
bottomheight = (window.screen.availHeight * 40 / 100) - 20;
}
alert("set window"
var UHJ = 'contractInfo.jhtml?orderNum=' + ordernum + '&custCode=' + custCode + '&AOMS=' + aoms + '&CUSTPO=' + custpo;
infoObj.checked = false;
alert("set page info and reset box to false"
window.open(UHJ,'test','scrollbars=yes');
}
}
called:
<INPUT TYPE="checkbox" NAME="param:index" VALUE="moreInfo" onClick="showInfo(this);">