Welcome, Guest
  • Author Topic: Form element name syntax  (Read 2336 times)

    Nik

    • Server what's that
    • *
    • Posts: 40
      • View Profile
      • Email
    Form element name syntax
    « on: 06/15/06, 05:53 »
    I have a funtion -

    <script language="javascript">
    setTickYes = function(){
    document.londonForm.field[1].value = "yes";
    }
    setTickNo = function(){
    document.londonForm.field[1].value = "";
    }
    </script>

    The form field with the label field[1] has to have this name as it is used by a mass mailing app.

    The current syntax resolves the form field name to 'field1' and the function fails because there
    is no field1 on the page.

    Can anyone tell me how to write the field[1] so that it 'sees' the []'s please?

    Nik

    • Server what's that
    • *
    • Posts: 40
      • View Profile
      • Email
    Re: Form element name syntax
    « Reply #1 on: 06/15/06, 06:46 »
    Never mind, I figured out a work-around ;D

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Form element name syntax
    « Reply #2 on: 06/17/06, 01:14 »
    field is an array, so field[1] is the second element of the array
    happy flashing
    8)
    Ronald