SELECT+TEXT INPUT

R

RHO

Hi'
I've got a probably easy question but haven't figured out what the answer is

In a form I've got an input text field named 'myText' and a SELECT field
mySelect. Outside the form I've defined an array like
myArray=new Array('Item1','Item2','Item3');
Now I want to change the value of the myText field in response to a change
in the mySelect field. I've made a function
One variant (among lots) is this one
Function myChangeFunc(id){
myForm.myText.value=myArray[id];
}

Another one is
eval("myForm.myText.value") = myArray[id];

Nothing seems to works. Please advise me !

Cheers,

RHO
 
R

Rollo Tomasi

RHO said:
Hi'
I've got a probably easy question but haven't figured out what the
answer is

In a form I've got an input text field named 'myText' and a SELECT
field mySelect. Outside the form I've defined an array like
myArray=new Array('Item1','Item2','Item3');
Now I want to change the value of the myText field in response to a
change in the mySelect field. I've made a function
One variant (among lots) is this one
Function myChangeFunc(id){
myForm.myText.value=myArray[id];
}

You should use function instead of Function.
Another one is
eval("myForm.myText.value") = myArray[id];

You can't use the result of a function on the left side of an assignment.
Nothing seems to works. Please advise me !

Cheers,

RHO

You didn't tell us how you get the value of id.
I guess that's where the error is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top