Re: ajax onBlur callback with load html: [...]
gettimothy <[email protected]> Tue, 21 Sep 2021 11:48:16 -0400
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <[email protected]> |
--===============6244795116509610675== Content-Type: multipart/alternative; boundary="----=_Part_52444_1936954935.1632239296785" ------=_Part_52444_1936954935.1632239296785 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable do you have a stack overflow area for this? ---- On Tue, 21 Sep 2021 11:21:31 -0400 Bob Nemec <[email protected]> wrote -= --- 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).=20 Found this from Joachim in the archive... ...we had to register 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 document) =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.=20 Seems that the rule for me is: don't reload components that contain onClick= scripts.=20 _______________________________________________ seaside mailing list [email protected] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside ------=_Part_52444_1936954935.1632239296785 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>= <meta content=3D"text/html;charset=3DUTF-8" http-equiv=3D"Content-Type"></h= ead><body ><div style=3D"font-family: Verdana, Arial, Helvetica, sans-serif= ; font-size: 10pt;"><div>do you have a stack overflow area for this?</div><= div><br></div><div class=3D"zmail_extra_hr" style=3D"border-top: 1px solid = rgb(204, 204, 204); height: 0px; margin-top: 10px; margin-bottom: 10px; lin= e-height: 0px;"><br></div><div class=3D"zmail_extra" data-zbluepencil-ignor= e=3D"true"><br><div id=3D"Zm-_Id_-Sgn1">---- On Tue, 21 Sep 2021 11:21:31 -= 0400 <b>Bob Nemec <[email protected]></b> wrote ----<br></div><br><bloc= kquote style=3D"margin: 0px;"><div><div class=3D"x_-1044981130yahoo-style-w= rap" style=3D"font-family : lucida console, sans-serif; font-size : 13px= ;"><div dir=3D"ltr"><div dir=3D"ltr"><pre style=3D"white-space : pre-wrap;= color : rgb(0, 0, 0);"><div dir=3D"ltr"><pre style=3D"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). <br></pre><pre style=3D"white= -space : pre-wrap; color : rgb(0, 0, 0);">Found this from Joachim in the = archive...<br></pre><pre style=3D"white-space : pre-wrap; color : rgb(0, = 0, 0);">...we had to register 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) {...} );&nbs= p;=20 (see <a href=3D"https://api.jquery.com/on/" rel=3D"nofollow" target=3D"_bla= nk">https://api.jquery.com/on/</a> <<a href=3D"https://api.jquery.com/on= /" rel=3D"nofollow" target=3D"_blank">https://api.jquery.com/on/</a>> fo= r details)<br></pre></div> In Seaside, this would look like this: (html jQuery document)  = ; on: 'blur'  = ; selector: '#myButton'  = ; do: (  = ; (html jQuery ajax) ....</pre><pre style=3D"white-space= : pre-wrap; color : rgb(0, 0, 0);"><br></pre><pre style=3D"white-space := pre-wrap; color : rgb(0, 0, 0);">...I tried that, but if I include the b= utton render in the reloaded div, with the on:selector:do: outside of the r= eloaded div, I get the same symptom: the 'click' (changed from 'blur') even= t does not consistently fire, as if the selector did not find the button. A= dding console.log() tracing shows the occasional absence of the button onCl= ick event. <br></pre><pre style=3D"white-space : pre-wrap; color : rgb(0,= 0, 0);">Seems that the rule for me is: don't reload components that contai= n onClick scripts. <br></pre></div><br></div></div></div>__________________= _____________________________<br>seaside mailing list<br>[email protected]= akfoundation.org<br>http://lists.squeakfoundation.org/cgi-bin/mailman/listi= nfo/seaside<br></blockquote></div><div><br></div></div><br></body></html> ------=_Part_52444_1936954935.1632239296785-- --===============6244795116509610675== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18Kc2Vhc2lkZSBt YWlsaW5nIGxpc3QKc2Vhc2lkZUBsaXN0cy5zcXVlYWtmb3VuZGF0aW9uLm9yZwpodHRwOi8vbGlz dHMuc3F1ZWFrZm91bmRhdGlvbi5vcmcvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3NlYXNpZGUK --===============6244795116509610675==--