J
Jon Knutson
I have a variable number of lines, with each line being a transaction,
displayed in my jsp. Each line has an amount value with the name
equal to the line it is displayed on. For example name=amount0 on
line 1
name=amount1 on line 2, etc...
I am attempting to edit the values in the amount field prior to
submitting the form. I have a for loop that goes through the lines
but haven't been able to come up with a way to dynamically address the
field. In the example below I was hoping that 'i' would append itself
to the field name 'tranLimit'. Unfortunatly, it doesn't. How would I
make the field name variable?
isMoney = /^\d+\.\d{2}$/;
// See list of all accounts available to user
function submit_form() {
continueSubmit = "Y";
rowCount = document.chglimits.rowCount.value;
for(i=0;i<rowCount;i++) {
if(!isMoney.test(document.chglimits."tranLimit"i.value)) {
alert('Invalid Dollar Amount');
continueSubmit = "N";
} else {
}
}
if(continueSubmit == "Y") {
document.chglimits.cmd.value = 'chg_tranlimit';
document.forms['chglimits'].submit();
}
}
displayed in my jsp. Each line has an amount value with the name
equal to the line it is displayed on. For example name=amount0 on
line 1
name=amount1 on line 2, etc...
I am attempting to edit the values in the amount field prior to
submitting the form. I have a for loop that goes through the lines
but haven't been able to come up with a way to dynamically address the
field. In the example below I was hoping that 'i' would append itself
to the field name 'tranLimit'. Unfortunatly, it doesn't. How would I
make the field name variable?
isMoney = /^\d+\.\d{2}$/;
// See list of all accounts available to user
function submit_form() {
continueSubmit = "Y";
rowCount = document.chglimits.rowCount.value;
for(i=0;i<rowCount;i++) {
if(!isMoney.test(document.chglimits."tranLimit"i.value)) {
alert('Invalid Dollar Amount');
continueSubmit = "N";
} else {
}
}
if(continueSubmit == "Y") {
document.chglimits.cmd.value = 'chg_tranlimit';
document.forms['chglimits'].submit();
}
}