I read in other posts that there are no references in VBScript -
however, it's possible to use this....

foo = "bar"
bar = "blah"
msgbox eval(foo)

How would this apply to getting variables from fields? I've got a form
which has various fields (in an HTA), lets say they are called "fld1",
"fld2" etc.... how would I get the values from these fields using a
variable reference....

If I were to do this to display "fld1", it would work....

Msgbox fld1.Value


But I actually want to do it like this (but it doesn't work
obviously!)...

foo = "fld1"
msgbox eval(foo).Value


Is there a way of writing the above, or a workaround so I can grab the
field values using a variable reference instead of direct variable
name??

Please end my hours of brainfry!!!
Cheers,
Simon

Re: Variable references by Georges

Georges
Thu Jun 23 08:08:27 CDT 2005

Hello,
If you try this in a html file, you'll see that you'll get the expected
result :
<html>
<head>
</head>
<body>
<input type="text" name="text1" value="texte2">
<script language="vbscript">
v_var ="text1"
msgbox eval(v_var).value
</script>
</body>
</html>

If you have an error what is it ?

Regards
Georges


<simon.green@aberdeenshire.gov.uk> a écrit dans le message de
news:1119530782.907055.224410@g49g2000cwa.googlegroups.com...
> I read in other posts that there are no references in VBScript -
> however, it's possible to use this....
>
> foo = "bar"
> bar = "blah"
> msgbox eval(foo)
>
> How would this apply to getting variables from fields? I've got a form
> which has various fields (in an HTA), lets say they are called "fld1",
> "fld2" etc.... how would I get the values from these fields using a
> variable reference....
>
> If I were to do this to display "fld1", it would work....
>
> Msgbox fld1.Value
>
>
> But I actually want to do it like this (but it doesn't work
> obviously!)...
>
> foo = "fld1"
> msgbox eval(foo).Value
>
>
> Is there a way of writing the above, or a workaround so I can grab the
> field values using a variable reference instead of direct variable
> name??
>
> Please end my hours of brainfry!!!
> Cheers,
> Simon
>



Re: Variable references by simon

simon
Thu Jun 23 08:15:30 CDT 2005

Lol.... thanks for the reply. You're absolutely right. I did a n00b
error whilst testing - the variable didn't contain anything!!

Thanks for setting me right. Brainfry is over!!!