cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robby.pelss...@vodafone.com
Subject RE: Woody question (how to give certain field focus at onload of document) Solution provided
Date Wed, 08 Sep 2004 09:52:28 GMT

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:ulf.sahlin@s2communications.se]
Sent: 08 September, 2004 09:48
To: users@cocoon.apache.org; robby.pelssers@vodafone.com
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: robby.pelssers@vodafone.com [mailto:robby.pelssers@vodafone.com]
> Skickat: den 7 september 2004 15:46
> Till: users@cocoon.apache.org
> Ä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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message