[Seaside-dev] Focus

Philippe Marschall philippe.marschall at gmail.com
Tue Jun 3 07:09:14 UTC 2014


On Mon, Jun 2, 2014 at 2:27 PM, Diego Lont <diego.lont at delware.nl> wrote:
> Hi all,
>
> 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.
> This is the code that I use to generate it:
> renderContentOn: canvas
>>         | textInput |
>         textInput := canvas textInput.
>         canvas document addLoadScript: 'document.getElementById("', textInput ensureId ,'").focus()'.
>         textInput on: #userid of: self
> ...
> And this is the resulting javascript:
>         /*<![CDATA[*/function onLoad(){"document.getElementById(\"id1\").focus()";};/*]]>*/
>
> 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 …
>
> Does anyone know how I can solve this?

If you have the same browser support policy as Google (only IE 10 and
11) then you can use the autofocus attribute.

Cheers
Philippe


More information about the seaside-dev mailing list