Click to See Complete Forum and Search --> : Getting strings from Forms.


Pyrus
07-10-2004, 12:19 AM
I know you could use:
eval(form.screen.value);
(where "form" is the name of the form and "screen" is the name of a number input type in the form) to get whatever is in that field as a number, but how do you get it as a string?

Nedals
07-10-2004, 12:23 AM
string = document.formname.elementname.value; // always returns a string
eval not required.

Pyrus
07-11-2004, 06:55 PM
Thank you so much, that little thing was holding back my progress.

fredmv
07-11-2004, 07:31 PM
Oh, and you almost never need eval. It's quite costly for the interpreter, so avoid it. Instead to convert strings to numbers use one of the methods as described in this thread (http://www.webxpertz.net/forums/showthread.php?t=27948).