« Return to Thread: Dynamically name form fields

Dynamically name form fields

by Dave Hannum :: Rate this Message:

Reply to Author | View in Thread

Hello,

I need to populate the value of a dynamically generated form field name.  But wrapping in an eval() does not work (at least the way I'm doing it).  Can someone show me how to properly do this?  Everything works fine down to where I try to assign the value of "cellPhone" to the dynamically named form field (the 'eval' line).

function putCell(ct) {
        var AC = eval("document.CFForm_1.cellA_"+ct+".value");
        var PX = eval("document.CFForm_1.cellP_"+ct+".value");
        var SX = eval("document.CFForm_1.cellS_"+ct+".value");
        var cellPhone = AC+"."+PX+"."+SX;
        eval("document.CFForm_1.document.CFForm_1.phoner_"+ct+".value") = cellPhone;
        document.getElementById('a11_'+ct).innerHTML = cellPhone;
        document.getElementById('a11_'+ct).style.visibility = 'visible';
        document.getElementById('a12_'+ct).style.visibility = 'hidden';
}

Thanks,
Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four times a year.
http://www.fusionauthority.com/quarterly

Archive: http://www.houseoffusion.com/groups/Javascript/message.cfm/messageid:3264
Subscription: http://www.houseoffusion.com/groups/Javascript/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.33

 « Return to Thread: Dynamically name form fields

LightInTheBox - Buy quality products at wholesale price!