fleet
asked on
Autotab - How do you reference a field when dynamically created?
I have a ColdFusion 8 form with a column of 10 date fields that are dynamically created. Each date is separated into 3 fields (month, day and year). The name of the month field is name="fstdt1<cfoutput>#New Row#</cfou tput>" .
After a person enters the month I want the cursor to automatically move to the next field (the day field). I need to reference each new field name in the Autotab. I currently have onKeyUp="AutoTab(fstdt1,fs tdt2)" and I get fstdt1 is undefined. Can someone tell me how to reference the fields in the AutoTab?
<input type="text" name="fstdt1<cfoutput>#New Row#</cfou tput>" onMouseOver="Javascript: window.status = 'Enter the Warrent Issued Month DD'; "class="colinput" style="width:20" maxlength=2 onKeyUp="AutoTab(fstdt1,fs tdt2)" tabindex="1">/
<input type="text" name="fstdt2<cfoutput>#New Row#</cfou tput>" onMouseOver="Javascript: window.status = 'Enter the Warrent Issued Day DD'; " onMouseOut="Javascript: window.status = '';" class="colinput" style="width:20" maxlength=2 onKeyUp="AutoTab(fstdt2,fs tdt3)" tabindex="1">/
<input type="text" name="fstdt3<cfoutput>#New Row#</cfou tput>" onMouseOver="Javascript: window.status = 'Enter the Warrent Issued Year YYYY'; " onMouseOut="Javascript: window.status = '';" class="colinput" style="width:30" maxlength=4>
After a person enters the month I want the cursor to automatically move to the next field (the day field). I need to reference each new field name in the Autotab. I currently have onKeyUp="AutoTab(fstdt1,fs
<input type="text" name="fstdt1<cfoutput>#New
<input type="text" name="fstdt2<cfoutput>#New
<input type="text" name="fstdt3<cfoutput>#New
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked great. Thank you so much.
<cfoutput>
<cfset dt1val = "fstdt1"& #NewRow# >
<cfset dt2val = "fstdt2"& #NewRow# >
<cfset dt3val = "fstdt3"& #NewRow# >
<input type="text" name="#dt1val#" onMouseOver="Javascript: window.status = 'Enter the Warrent Issued Month DD'; "class="colinput" style="width:20" maxlength=2 onKeyUp="AutoTab(#dt1val#,
<input type="text" name="#dt2val#" onMouseOver="Javascript: window.status = 'Enter the Warrent Issued Day DD'; " onMouseOut="Javascript: window.status = '';" class="colinput" style="width:20" maxlength=2 onKeyUp="AutoTab(#dt2val#,
<input type="text" name="#dt3val#" onMouseOver="Javascript: window.status = 'Enter the Warrent Issued Year YYYY'; " onMouseOut="Javascript: window.status = '';" class="colinput" style="width:30" maxlength=4>
</cfoutput>
now your autotab function will get correct input type names
<script type="text/javascript">var