cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <...@outerthought.org>
Subject Re: Woody question (how to give certain field focus at onload of document) Solution provided
Date Wed, 08 Sep 2004 10:31:43 GMT
cool, just for completeness though:

when upgrading from woody to cforms (which is highly recommended) you 
should:

watch out with those on_load thingies, you might be killing the 
necessary onload of other widgets in the form (e.g. used by advanced 
widgets like calendar or html area and whatnot)

the way to add your own code to the 'onload' event is therefor a bit 
different when you use the provided xsl's from samples/resources

forms_onloadHandlers[forms_onloadHandlers.length] = 
document.login.id.focus; // not tested, so might have some syntax issues


see the forms_onloadHandlers Array declared and used in form_lib.js
http://cvs.apache.org/viewcvs.cgi/cocoon/trunk/src/blocks/forms/samples/resources/forms-lib.js?rev=36594&root=Apache-SVN&view=auto


HTH
-marc=

robby.pelssers@vodafone.com wrote:

> 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
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@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