ajax onBlur callback with load html: [...]
Bob Nemec <[email protected]> Tue, 21 Sep 2021 15:21:31 +0000 (UTC)
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <[email protected]> |
--===============2837816259378278275==
Content-Type: multipart/alternative;
boundary="----=_Part_1870079_1948526552.1632237691121"
------=_Part_1870079_1948526552.1632237691121
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
For some reason I am no longer getting these emails. (I'd really like to mo=
ve this mailing list to better forum, like a Google Group or questions on S=
tack Overflow). Found this from Joachim in the archive......we had to regis=
ter an event handler with the doument using an=20
extra selector. in Javascript you'd have to do it like this:
$(document).on("click","button#idOfTheButton", function(event) {...} );=C2=
=A0=20
(see https://api.jquery.com/on/ <https://api.jquery.com/on/> for details)In=
Seaside, this would look like this: =C2=A0=C2=A0=C2=A0 (html jQuery docume=
nt) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 on: 'blur' =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =
=C2=A0=C2=A0=C2=A0 selector: '#myButton' =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 do: ( =C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (html=
jQuery ajax) ....
...I tried that, but if I include the button render in the reloaded div, wi=
th the on:selector:do: outside of the reloaded div, I get the same symptom:=
the 'click' (changed from 'blur') event does not consistently fire, as if =
the selector did not find the button. Adding console.log() tracing shows th=
e occasional absence of the button onClick event. Seems that the rule for m=
e is: don't reload components that contain onClick scripts.=20
------=_Part_1870079_1948526552.1632237691121
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<html><head></head><body><div class="yahoo-style-wrap" style="font-family:lucida console, sans-serif;font-size:13px;"><div dir="ltr" data-setdir="false"><div dir="ltr" data-setdir="false"><pre style="white-space: pre-wrap; color: rgb(0, 0, 0);"><div dir="ltr" data-setdir="false"><pre style="white-space: pre-wrap; color: rgb(0, 0, 0);">For some reason I am no longer getting these emails. (I'd really like to move this mailing list to better forum, like a Google Group or questions on Stack Overflow). </pre><pre style="white-space: pre-wrap; color: rgb(0, 0, 0);">Found this from Joachim in the archive...</pre><pre style="white-space: pre-wrap; color: rgb(0, 0, 0);">...we had to register an event handler with the doument using an
extra selector. in Javascript you'd have to do it like this:
$(document).on("click","button#idOfTheButton", function(event) {...} );
(see <a href="https://api.jquery.com/on/" rel="nofollow" target="_blank">https://api.jquery.com/on/</a> <<a href="https://api.jquery.com/on/" rel="nofollow" target="_blank">https://api.jquery.com/on/</a>> for details)</pre></div>
In Seaside, this would look like this:
(html jQuery document)
on: 'blur'
selector: '#myButton'
do: (
(html jQuery ajax) ....</pre><pre style="white-space: pre-wrap; color: rgb(0, 0, 0);"><br></pre><pre style="white-space: pre-wrap; color: rgb(0, 0, 0);">...I tried that, but if I include the button render in the reloaded div, with the on:selector:do: outside of the reloaded div, I get the same symptom: the 'click' (changed from 'blur') event does not consistently fire, as if the selector did not find the button. Adding console.log() tracing shows the occasional absence of the button onClick event. </pre><pre style="white-space: pre-wrap; color: rgb(0, 0, 0);">Seems that the rule for me is: don't reload components that contain onClick scripts. </pre></div><br></div></div></body></html>
------=_Part_1870079_1948526552.1632237691121--
--===============2837816259378278275==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18Kc2Vhc2lkZSBt
YWlsaW5nIGxpc3QKc2Vhc2lkZUBsaXN0cy5zcXVlYWtmb3VuZGF0aW9uLm9yZwpodHRwOi8vbGlz
dHMuc3F1ZWFrZm91bmRhdGlvbi5vcmcvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3NlYXNpZGUK
--===============2837816259378278275==--