<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 2, 2014 at 2:32 PM, Sven Van Caekenberghe <span dir="ltr"><<a href="mailto:sven@stfx.eu" target="_blank">sven@stfx.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I do it like this:<br>
<br>
renderJavaScriptOn: html<br>
| target |<br>
target := self username<br>
ifNil: [ 'form #username' ]<br>
ifNotNil: [ 'form #password' ].<br>
html script: (html jQuery: target) triggerFocus<br>
<br>
for a login component (the focus is set on the username field unless it is filled in, in which case the focus goes to the password field).<br></blockquote><div><br></div><div>jQuery indeed. Now, script: will do that in place. So, if you are loading things at the bottom of the script, it will fail.</div>
<div><br></div><div>I wondered what is your practice regarding those things.</div><div><br></div><div>Now, I am putting things in <head> so that everything works as advertised.</div><div><br></div><div>Phil</div><div>
<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On 02 Jun 2014, at 14:27, Diego Lont <<a href="mailto:diego.lont@delware.nl">diego.lont@delware.nl</a>> wrote:<br>
<br>
> Hi all,<br>
><br>
> I must miss very simple, because I fail to set the focus of my element. I tried stripping my component, but still it does do nothing. I think the problem lies in the generated javascript.<br>
> This is the code that I use to generate it:<br>
> renderContentOn: canvas<br>
> …<br>
> | textInput |<br>
> textInput := canvas textInput.<br>
> canvas document addLoadScript: 'document.getElementById("', textInput ensureId ,'").focus()'.<br>
> textInput on: #userid of: self<br>
> ...<br>
> And this is the resulting javascript:<br>
> /*<![CDATA[*/function onLoad(){"document.getElementById(\"id1\").focus()";};/*]]>*/<br>
><br>
> When I look at this javascript, I see that my parameter (“id”) is encoded. This is probably why it does not find the element indicated …<br>
><br>
> Does anyone know how I can solve this?<br>
><br>
> Cheers,<br>
> Diego_______________________________________________<br>
> seaside-dev mailing list<br>
> <a href="mailto:seaside-dev@lists.squeakfoundation.org">seaside-dev@lists.squeakfoundation.org</a><br>
> <a href="http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev</a><br>
<br>
_______________________________________________<br>
seaside-dev mailing list<br>
<a href="mailto:seaside-dev@lists.squeakfoundation.org">seaside-dev@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev</a><br>
</blockquote></div><br></div></div>