[Ur] When testing the new wrapper for the Pikaday datepicker, adding another <textbox> makes the tag <body onload={...}> stop working

Stefan Scott Alexander stefanscottalexx at gmail.com
Sun Aug 9 18:15:22 EDT 2015


Further testing reveals some strange behavior:

(1) If the <textbox> for the Date field is the *first* field inside the
<form>, then its datepicker appears - ie, using the following code, the
datepicker appears:

  <body onload={PikadayControl.init date_nid}>
    <form>
      <textbox{#DateField} id={date_nid}/>
      <textbox{#NameField} />
      <submit action={add_thing} value="Add !"/>
    </form>
  </body>

(2) But if the Date field is *not* the first field inside the <form>, its
datepicker does *not* appear:

  <body onload={PikadayControl.init date_nid}>
    <form>
      <textbox{#NameField} />
      <textbox{#DateField} id={date_nid}/>
      <submit action={add_thing} value="Add !"/>
    </form>
  </body>

The above two code fragments are identical, except for the *ordering* of
the fields inside the <form>.

(3) Also, if there is a string before the Date field, the datepicker does
not display:

  <body onload={PikadayControl.init date_nid}>
    <form>
      Date: <textbox{#DateField} id={date_nid}/><br/>
      Name: <textbox{#NameField} />
      <submit action={add_thing} value="Add !"/>
    </form>
  </body>

(But I'm not sure if strings such as "Date:" and "Name:" are actually
allowed in that position, inside a <form>.)


Discussion:

For some reason, the datepicker only appears when the Date field is the
*first* element in the <form>.

I am curious why this is happening.

Thanks for any help!

###
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150809/a4586da4/attachment.html>


More information about the Ur mailing list