Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1207

A form control component (such as TextField) whose id is "id" can confuse client-side logic for the Form DOM object

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.2.0
    • 5.2.0
    • tapestry-core
    • None

    Description

      Using Chrome's page inspector, I can see that the form's element has been rewritten, from:

      <form class="margin3-5-5" onsubmit="javascript:return Tapestry.waitForPage(event);" action="/t5/widendev/searchadmin.removedoc.form" method="post" id="form_3"

      to:

      <form class="margin3-5-5" onsubmit="javascript:return Tapestry.waitForPage(event);" action="/t5/widendev/searchadmin.removedoc.form" method="post" id="[object HTMLInputElement]"><div class="" style="display: none; ">

      ....

      ah, there is is:

      <label for="id">ID</label>
      <input class="normalField width60" size="5" id="id" name="id" type="text"></input><img id="id_icon" class="t-error-icon t-invisible" alt="" src="/assets/5.5.1_1/core/spacer.gif"/>

      Having a form element with id "id" is bad!

      Basically, each element of the form is mapped onto the Form as a property; so HTMLInputElement#id overwrites the id property of the Form (changing it from type string to type HTMLINputElement).

      "id" and perhaps other names need to be added to the list of pre-reserved element ids inside the Form.

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            hlship Howard Lewis Ship
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: