<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><a href="http://api.jquery.com/jQuery.ajaxSetup/">http://api.jquery.com/jQuery.ajaxSetup/</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>or,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>jQuery.ajaxSetup({<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> "error":function(jqXHR,textStatus,errorThrown){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> if (jqXHR.status === 403) {window.location="/online?expired";}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>});<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>or,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>JQAjaxSetup>>onError:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>HTH,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>-Boris<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> seaside-bounces@lists.squeakfoundation.org [mailto:seaside-bounces@lists.squeakfoundation.org] <b>On Behalf Of </b>Alexander Lazarevic<br><b>Sent:</b> Tuesday, October 18, 2011 7:00 AM<br><b>To:</b> Seaside - general discussion<br><b>Subject:</b> Re: [Seaside] checkbox callbacks<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Now I need to find a solution for session timeouts. If a session times out and the user clicks on a checkbox nothing happens (obviously).<br>How can I redirect that request to act as an initial request for the root component (so to say)?<br><br>Thanks,<br> Alex<o:p></o:p></p><div><p class=MsoNormal>2011/9/26 Alexander Lazarević <<a href="mailto:laza@blobworks.com">laza@blobworks.com</a>><o:p></o:p></p><p class=MsoNormal>Sweet! That works like a charm. Thanks<br><br>Alex<br><br>2011/9/26 Lukas Renggli <<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>>:<o:p></o:p></p><div><div><p class=MsoNormal>> On 26 September <a href="tel:2011%2013">2011 13</a>:39, Lukas Renggli <<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>> wrote:<br>>> It is probably the easiest if you just re-render that part of the<br>>> page. I suggest a refactorings along the following lines:<br>>><br>>>> renderContentOn: html<br>>><br>>> | id |<br>>> id := html nextId.<br>>> html div id: id; with: [<br>>><br>>>> html form: [<br>>>> html checkbox<br>>>> onChange: (html jQuery ajax serializeThisWithHidden);<br>>><br>>> You do replace the above line with:<br>>><br>>> onChange: ((html jQuery id: id) load serializeThisWithHidden;<br>>> html: [ :r | self renderContentOn: r ])<br>><br>> Sorry, this is a bit buggy. You don't want to re-render the div here,<br>> just what is inside. So better extract the inner part to a separate<br>> method.<br>><br>>><br>>>> value: self isChecked;<br>>>> callback: [:value | self check: value. self check2: value].<br>>>> html text: 'Check me'.<br>>>> html checkbox<br>>>> onChange: (html jQuery ajax serializeThisWithHidden);<br>>><br>>> And do the same here. Maybe extract it to a separate method so that<br>>> you can reuse it.<br>>><br>>>> value: self isChecked2;<br>>>> callback: [:value | self check2: value. self check: value not].<br>>>> html text: 'Check me 2'.<br>>>> ]<br>>>><br>>>> So what's the best strategy to update the checkboxes reflecting the<br>>>> internal state?<br>>><br>>> ] "close the div here"<br>>><br>>> Cheers,<br>>> Lukas<br>>><br>>>><br>>>> Alex<br>>>><br>>>> 2011/9/26 Alexander Lazarević <<a href="mailto:laza@blobworks.com">laza@blobworks.com</a>>:<br>>>>> Robert and Lukas,<br>>>>><br>>>>> I guess I still have some misconceptions when it comes to JS<br>>>>> callbacks, but thanks for helping me along. I had the idea that the<br>>>>> entire form gets serialized, but only the callbacks of changed<br>>>>> elements would trigger a onChange: event and then trigger the<br>>>>> callback.<br>>>>><br>>>>> Alex<br>>>>><br>>>>> 2011/9/24 Lukas Renggli <<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>>:<br>>>>>> Yes, you serialize the form which means it involves both checkboxes. On your<br>>>>>> scenario both callbacks should be triggered: the checked one with true, the<br>>>>>> unchecked with false.<br>>>>>><br>>>>>> Btw, you do not need the IDs. For the AJAX just use (html jQuery ajax<br>>>>>> serializeForm). You don't want to load anything into the checkbox.<br>>>>>><br>>>>>> Lukas<br>>>>>><br>>>>>> On Saturday, 24 September 2011, Alexander Lazarević <<a href="mailto:laza@blobworks.com">laza@blobworks.com</a>><br>>>>>> wrote:<br>>>>>>> Hi!<br>>>>>>><br>>>>>>> I'm using something like the following in my code:<br>>>>>>><br>>>>>>> renderContentOn: html<br>>>>>>> | id |<br>>>>>>> html form: [<br>>>>>>> id := html nextId.<br>>>>>>> html checkbox<br>>>>>>> id: id;<br>>>>>>> onChange: (html jQuery id: id) load serializeForm;<br>>>>>>> value: self isChecked;<br>>>>>>> callback: [:value | value inspect].<br>>>>>>> html text: 'Check me'.<br>>>>>>> id := html nextId.<br>>>>>>> html checkbox<br>>>>>>> id: id;<br>>>>>>> onChange: (html jQuery id: id) load serializeForm;<br>>>>>>> value: self isChecked2;<br>>>>>>> callback: [:value | value inspect].<br>>>>>>> html text: 'Check me 2'.<br>>>>>>> ]<br>>>>>>><br>>>>>>> I'm surprised to see that both callbacks get triggered even if I only<br>>>>>>> check one checkbox. Is this on purpose and expected? According to<br>>>>>>> Metacello I'm using Seaside 3.0.6<br>>>>>>><br>>>>>>> Alex<br>>>>>>> _______________________________________________<br>>>>>>> seaside mailing list<br>>>>>>> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>>>>>>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>>>>>>><br>>>>>><br>>>>>> --<br>>>>>> Lukas Renggli<br>>>>>> <a href="http://www.lukas-renggli.ch" target="_blank">www.lukas-renggli.ch</a><br>>>>>><br>>>>>> _______________________________________________<br>>>>>> seaside mailing list<br>>>>>> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>>>>>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>>>>>><br>>>>>><br>>>>><br>>>> _______________________________________________<br>>>> seaside mailing list<br>>>> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>>>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>>>><br>>><br>>><br>>><br>>> --<br>>> Lukas Renggli<br>>> <a href="http://www.lukas-renggli.ch" target="_blank">www.lukas-renggli.ch</a><br>>><br>><br>><br>><br>> --<br>> Lukas Renggli<br>> <a href="http://www.lukas-renggli.ch" target="_blank">www.lukas-renggli.ch</a><br>> _______________________________________________<br>> seaside mailing list<br>> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></body></html>