Folks,
This problem is directly a Javascript question, but ColdFusion is involved too. In the example below #currentRow# is the row number I’m on as I cycle through a CFQUERY using CFLOOP. I loop through, creating multiple text box controls for every item in my table. Everything seems to work well, except the “&&” in my Javascript function doesn’t seem to be recognized. Here’s my code:
In my <HEAD> area I have:
<script language="JavaScript">
function myTest
{
var currentqty = eval('document.form1.quantity' + n).value;
var currentinc = eval('document.form1.increment' + n).value;
if((currentinc != 0) && (currentqty % currentinc != 0)) {
alert("You must order this part in increments of " + currentinc + " (" + currentinc + ", " + (currentinc*2) + ", " + (currentinc*3) + "...)"
;
}
}
In my <BODY>:
<input name="quantity#currentrow#" type="text" class="font003" value="0" size="3" onChange="myTest(#currentRow#);"
The problem seems to be the "&&" portion of the code. I'm (obviously) not a huge JS programmer, but I've tried many different combinations (just checking the first part of the "if" statement which works fine, etc) It definitely seems like the "&&" isn't being evaluated correctly...
The error I get just says "Syntax Error", but the line/position point right to the "&&"... Arrgh!
Any help would be VERY appreciated!
Thanks!
Steve
This problem is directly a Javascript question, but ColdFusion is involved too. In the example below #currentRow# is the row number I’m on as I cycle through a CFQUERY using CFLOOP. I loop through, creating multiple text box controls for every item in my table. Everything seems to work well, except the “&&” in my Javascript function doesn’t seem to be recognized. Here’s my code:
In my <HEAD> area I have:
<script language="JavaScript">
function myTest
var currentqty = eval('document.form1.quantity' + n).value;
var currentinc = eval('document.form1.increment' + n).value;
if((currentinc != 0) && (currentqty % currentinc != 0)) {
alert("You must order this part in increments of " + currentinc + " (" + currentinc + ", " + (currentinc*2) + ", " + (currentinc*3) + "...)"
}
}
In my <BODY>:
<input name="quantity#currentrow#" type="text" class="font003" value="0" size="3" onChange="myTest(#currentRow#);"
The problem seems to be the "&&" portion of the code. I'm (obviously) not a huge JS programmer, but I've tried many different combinations (just checking the first part of the "if" statement which works fine, etc) It definitely seems like the "&&" isn't being evaluated correctly...
The error I get just says "Syntax Error", but the line/position point right to the "&&"... Arrgh!
Any help would be VERY appreciated!
Thanks!
Steve