We found out how to do it yesterday:  give the template a name-attribute
(e.g. login) and the body tag an onload attribute
 with value: document.nameOfForm.NameOfField.focus()

Regards,
Robby

<html>
  <head>
    <title>Access Control</title>
  </head>
  <body onload="document.login.id.focus();">
    <h1>Login</h1>
    <p>${message}</p>
    
    <wt:form-template
      action="continuation:${cocoon.continuation.id}"
      method="POST"
      name="login">
      <table class="panel"> 
        <caption>Login</caption>
        <tr> 
          <td> 
            <wi:group> 
              <wi:styling layout="columns"/>
              <wi:items> 
                <wt:widget id="id"/>
                <wt:widget id="password">
                  <wi:styling type="password"/>
                </wt:widget>
                <wt:widget id="changepassword"/>
              </wi:items> 
            </wi:group> 
          </td> 
        </tr> 
      </table> 
      <wt:widget id="login">
        <wi:styling class="button"/>
      </wt:widget>
      <wt:widget id="cancel">
        <wi:styling class="button"/>
      </wt:widget>
    </wt:form-template>
  </body>
</html>
-----Original Message-----
From: Ulf Sahlin [mailto:[EMAIL PROTECTED]
Sent: 08 September, 2004 09:48
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Woody question (how to give certain field focus at onload
of document)


Hello Robby!

You could try some <fi:styling myAttr="doSomething()"> element in the form
template, since all attributes to that element is copied into the resulting
input tag in the standard cforms field transformer:

...
      <xsl:if test="fi:styling">
        <xsl:copy-of select="fi:styling/@*"/>
      </xsl:if>
...

Another option would be to include a simple javascript in the template that
does the focusing job.


Regards,
   Ulf Sahlin


> -----Ursprungligt meddelande-----
> Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Skickat: den 7 september 2004 15:46
> Till: [EMAIL PROTECTED]
> Ämne: Woody question (how to give certain field focus at onload of
> document)
>
>
> Hi,
>
> anyone who knows how to give a woody field (input field) focus
> when the page
> is loaded ?
>
> Kind regards,
> Robby
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to