<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">&lt;<a href="mailto:sven@stfx.eu" target="_blank">sven@stfx.eu</a>&gt;</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: [ &#39;form #username&#39; ]<br>
                ifNotNil: [ &#39;form #password&#39; ].<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 &lt;head&gt; 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 &lt;<a href="mailto:diego.lont@delware.nl">diego.lont@delware.nl</a>&gt; wrote:<br>
<br>
&gt; Hi all,<br>
&gt;<br>
&gt; 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>
&gt; This is the code that I use to generate it:<br>
&gt; renderContentOn: canvas<br>
&gt; …<br>
&gt;       | textInput |<br>
&gt;       textInput := canvas textInput.<br>
&gt;       canvas document addLoadScript: &#39;document.getElementById(&quot;&#39;, textInput ensureId ,&#39;&quot;).focus()&#39;.<br>
&gt;       textInput on: #userid of: self<br>
&gt; ...<br>
&gt; And this is the resulting javascript:<br>
&gt;       /*&lt;![CDATA[*/function onLoad(){&quot;document.getElementById(\&quot;id1\&quot;).focus()&quot;;};/*]]&gt;*/<br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; Does anyone know how I can solve this?<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Diego_______________________________________________<br>
&gt; seaside-dev mailing list<br>
&gt; <a href="mailto:seaside-dev@lists.squeakfoundation.org">seaside-dev@lists.squeakfoundation.org</a><br>
&gt; <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>