SELECT+TEXT INPUT

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RHO

    SELECT+TEXT INPUT

    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.v alue=myArray[id];
    }

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

    Nothing seems to works. Please advise me !

    Cheers,

    RHO


  • Rollo Tomasi

    #2
    Re: SELECT+TEXT INPUT

    RHO wrote:[color=blue]
    > 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.v alue=myArray[id];
    > }[/color]

    You should use function instead of Function.
    [color=blue]
    > Another one is
    > eval("myForm.my Text.value") = myArray[id];[/color]

    You can't use the result of a function on the left side of an assignment.
    [color=blue]
    > Nothing seems to works. Please advise me !
    >
    > Cheers,
    >
    > RHO[/color]

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

    --

    Rollo Tomasi


    Comment

    Working...