Object names with square bracket

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

    Object names with square bracket

    Hi,
    i want to update several Textboxes by reading the value of another
    Box. For that i use the following small script:

    <form name="form1" method="POST">
    <input type="text" name="xx" value ="1"
    onBlur="documen t.form1.tex1.va lue=document.fo rm1.xx.value">< br>
    <input name="tex1" type="text" size=16 maxlength=80 value="1">
    </form>

    Everything works fine, but for my PHP-Script i need square brackets [
    ]. If i try to add them, my Script got an error:

    <form name="form1" method="POST">
    <input type="text" name="xx" value ="1"
    onBlur="documen t.form1.tex[1].value=document .form1.xx.value "><br>
    <input name="tex[1]" type="text" size=16 maxlength=80 value="1">
    </form>

    Whats wrong?

    Thanks!
  • lallous

    #2
    Re: Object names with square bracket

    Hello

    This is a common issue.

    Access the named object from javascript as:

    theForm["elementNam e"].value = xyz .... or
    theForm.element s["elementNam e"].value = "asdasda";

    Example:

    theForm["tex[1]"].value = xxxxxxxxxxxx... .............

    HTH,
    Elias
    "Nalpo" <fgr@mikroplan. com> wrote in message
    news:d3737bd9.0 408102329.7b971 dce@posting.goo gle.com...[color=blue]
    > Hi,
    > i want to update several Textboxes by reading the value of another
    > Box. For that i use the following small script:
    >
    > <form name="form1" method="POST">
    > <input type="text" name="xx" value ="1"
    > onBlur="documen t.form1.tex1.va lue=document.fo rm1.xx.value">< br>
    > <input name="tex1" type="text" size=16 maxlength=80 value="1">
    > </form>
    >
    > Everything works fine, but for my PHP-Script i need square brackets [
    > ]. If i try to add them, my Script got an error:
    >
    > <form name="form1" method="POST">
    > <input type="text" name="xx" value ="1"
    > onBlur="documen t.form1.tex[1].value=document .form1.xx.value "><br>
    > <input name="tex[1]" type="text" size=16 maxlength=80 value="1">
    > </form>
    >
    > Whats wrong?
    >
    > Thanks![/color]


    Comment

    Working...