Page 1 of 1

Variable CNT1 is undefined when using Javascript

Posted: 2011-01-21 19:43
by jlig
Does anyone have any idea how to reference an ADDT field/form/Id on a Form?

- The ID for my first Text box is: inputtext (sees this one fine)
- The ID for my second text box is: wkRptOrdStaNts_<cfoutput>#cnt1#</cfoutput>

Javascript is unable to see the second text box ID/value because of all the extra variables in it i guess? (I get the error: Variable CNT1 is undefined)

Here is my Javascript code:
--------------------------
<script language="javascript" type="text/javascript">
function addtext() {
var newtext = document.getElementById('inputtext');
document.getElementById('wkRptOrdStaNts_<cfoutput>#cnt1#</cfoutput>') += newtext;

}
</script>
---------------------------

Re: Variable CNT1 is undefined when using Javascript

Posted: 2011-01-22 12:55
by Fred
Can you get rid of the # in the variable name?

I used a # in a dropdown as one of the vaules. Part of the java function if var = # then...
And it just didn't work.
I took out the # and it worked fine.