Variable CNT1 is undefined when using Javascript

Any tips and tricks that has to with the ADDT that doesn't fit into one of the other categories
jlig
Posts: 35
Joined: 2010-07-09 16:17

Variable CNT1 is undefined when using Javascript

Post by jlig » 2011-01-21 19:43

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>
---------------------------

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Variable CNT1 is undefined when using Javascript

Post by Fred » 2011-01-22 12:55

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.

Post Reply