Although this is a JavaScript question (OT) not a CF question.  you might
want to try 

oldvalue = eval("document."+FormName+"."+FieldName+".value")

Steven Semrau
SRA International, Inc.
Senior Member, Professional Staff
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Com:  (703) 805-1095
DSN:  (703) 655-1095


-----Original Message-----
From: Bruce, Rodney [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 18, 2001 11:21 AM
To: CF-Talk
Subject: Setting form var with Java


Sent this once already but have not gotten any replies, can anyone help?

A little help please.  I am trying to use some javascript on my CF pages.  I
would like to pass the formname and  fieldname to the function, perform an
action and return the value: i.e.

<SCRIPT LANGUAGE = "JavaScript">
<!--
function changevalue(FormName, FieldName)
{
        var oldvalue;
        var newvalue;

        oldvalue = document.FormName.FieldName.value;

        TAKE ACTION HERE

        document.FormName.FieldName.value = newvalue;
}
//-->
</SCRIPT>

The formname and Fieldnames are being passed fine,  but how do I use them.
now oldvalue is being set EQ to "document.FormName.FieldName.value" not the
value of the field ,  how can I get the value from the form field. 

If I call the formfield in the function by hardcoding its name I get the
function to work fine, but I would like to re-use this without having to
change the function each time.

Thanks for your help
Rodney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to