The following snippet seems to be working fine, but as a next step I'm trying
to find a way to add/remove class names to a specific element corresponding to this checkbox, | fid | fid := html nextId. (html form) id: fid; with: [(html checkbox) value: (self isSelected: row); callback: [:value | self select: row if: value]; onClick: ((html updater) triggerForm: fid; yourself)] something along the lines of, (self isSelected: row) ifTrue: [script element id: fid; addClassName: 'selected'] ifFalse: [script element id: fid; removeClassName: 'selected'] but I'm not sure where to plug that in just yet. Any pointers would be appreciated. Thanks! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
Okay, getting somewhat closer, yet not quite all the way yet,
onClick: ((html evaluator) triggerForm: fid; yourself); onClick: ((html element) id: row webid; addClassName: 'selected'; yourself) This works fine, so at least I know I can append various elements together in the onClick, which I didn't realize before. Now I need to figure out how to have a parameterized "element" event firing where I could either do addClass or removeClass depending on whether the object is selected... I'm not convinced I'm headed in the right direction yet though, because I have a sneaking suspicion this should all be doable from within a single onClick event. -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov Sent: Tuesday, June 27, 2006 9:17 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: [Seaside] [Scriptaculous] Configure element's class from inside theupdater? The following snippet seems to be working fine, but as a next step I'm trying to find a way to add/remove class names to a specific element corresponding to this checkbox, | fid | fid := html nextId. (html form) id: fid; with: [(html checkbox) value: (self isSelected: row); callback: [:value | self select: row if: value]; onClick: ((html updater) triggerForm: fid; yourself)] something along the lines of, (self isSelected: row) ifTrue: [script element id: fid; addClassName: 'selected'] ifFalse: [script element id: fid; removeClassName: 'selected'] but I'm not sure where to plug that in just yet. Any pointers would be appreciated. Thanks! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
What an excellent trial-and-error exercise this is, I got the darn thing
folded into one onClick in code, although it does the same thing still :) | fid | fid := html nextId. (html form) id: fid; with: [(html checkbox) value: (self isSelected: row); callback: [:value | self select: row if: value]; onClick: ((html evaluator) triggerForm: fid; callback: [:script | ] value: (html element) id: row webid; addClassName: 'selected'; yourself); yourself)] But I still can't quite figure out how to pick whether I want to add or remove a class based on the selection criteria, Anyone? -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov Sent: Tuesday, June 27, 2006 9:52 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: RE: [Seaside] [Scriptaculous] Configure element's class from insidetheupdater? Okay, getting somewhat closer, yet not quite all the way yet, onClick: ((html evaluator) triggerForm: fid; yourself); onClick: ((html element) id: row webid; addClassName: 'selected'; yourself) This works fine, so at least I know I can append various elements together in the onClick, which I didn't realize before. Now I need to figure out how to have a parameterized "element" event firing where I could either do addClass or removeClass depending on whether the object is selected... I'm not convinced I'm headed in the right direction yet though, because I have a sneaking suspicion this should all be doable from within a single onClick event. -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov Sent: Tuesday, June 27, 2006 9:17 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: [Seaside] [Scriptaculous] Configure element's class from inside theupdater? The following snippet seems to be working fine, but as a next step I'm trying to find a way to add/remove class names to a specific element corresponding to this checkbox, | fid | fid := html nextId. (html form) id: fid; with: [(html checkbox) value: (self isSelected: row); callback: [:value | self select: row if: value]; onClick: ((html updater) triggerForm: fid; yourself)] something along the lines of, (self isSelected: row) ifTrue: [script element id: fid; addClassName: 'selected'] ifFalse: [script element id: fid; removeClassName: 'selected'] but I'm not sure where to plug that in just yet. Any pointers would be appreciated. Thanks! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
> What an excellent trial-and-error exercise this is, I got the darn thing
> folded into one onClick in code, although it does the same thing still :) Yeah, interesting process. I experienced similar trial-and-error exercises ;-) > | fid | > fid := html nextId. > (html form) > id: fid; > with: > [(html checkbox) > value: (self isSelected: row); > callback: [:value | self select: row if: value]; > onClick: > ((html evaluator) > triggerForm: fid; > callback: [:script | ] > value: (html element) > id: row webid; > addClassName: 'selected'; > yourself); > yourself)] 1. Your brackets and semicolons are very strangely placed. I think they are probably wrong and cause some problems. 2. You don't need "html evaluator" if you don't inject a script into the web-page, just use "html request" for simple requests. 3. The AJAX objects (request, updater, evaluator, etc.) understand a set of events, such as #onComplete:, #onFailure:, #onSuccess:, etc. I would use one of these events (probably #onSuccess:) to change the class of your element. Maybe write a helper function in JavaScript that takes the element and the checkbox as parameters and toggles the classes appropriately. Then you can attach this function to the event handler. Hope this helps, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Lukas,
1. It's the formatter, really :) 2. Okay, cool. 3. How do you define onSuccess? I've tried the following with the non-existing 'bag', but don't see the error in the Firefox's JavaScript console, which prompts me to think that its not being called. Am I using a wrong protocol for this? The request itself works just fine. (html request) triggerForm: fid; onSuccess: 'bah()'; yourself Cheers! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Lukas Renggli Sent: Tuesday, June 27, 2006 10:49 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: Re: [Seaside] [Scriptaculous] Configure element's class frominsidetheupdater? > What an excellent trial-and-error exercise this is, I got the darn thing > folded into one onClick in code, although it does the same thing still :) Yeah, interesting process. I experienced similar trial-and-error exercises ;-) > | fid | > fid := html nextId. > (html form) > id: fid; > with: > [(html checkbox) > value: (self isSelected: row); > callback: [:value | self select: row if: value]; > onClick: > ((html evaluator) > triggerForm: fid; > callback: [:script | ] > value: (html element) > id: row webid; > addClassName: 'selected'; > yourself); > yourself)] they are probably wrong and cause some problems. 2. You don't need "html evaluator" if you don't inject a script into the web-page, just use "html request" for simple requests. 3. The AJAX objects (request, updater, evaluator, etc.) understand a set of events, such as #onComplete:, #onFailure:, #onSuccess:, etc. I would use one of these events (probably #onSuccess:) to change the class of your element. Maybe write a helper function in JavaScript that takes the element and the checkbox as parameters and toggles the classes appropriately. Then you can attach this function to the event handler. Hope this helps, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
Here's what I'm getting when I try to do,
onClick: ((html request) triggerForm: fid; onSuccess: 'alert("hello");'; yourself) ... onclick="new Ajax.Request('http://localhost:8008/online',{onSuccess:function(){'alert("he llo");'},parameters:['_k=tWoPdDJi','84',Form.serialize('id82')].join('&')})" I'm guessing I'm misusing the onSuccess protocol, because nothing happens, even though I can see the request completing on the back. Pointers? -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov Sent: Tuesday, June 27, 2006 11:53 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: RE: [Seaside] [Scriptaculous] Configure element's classfrominsidetheupdater? Lukas, 1. It's the formatter, really :) 2. Okay, cool. 3. How do you define onSuccess? I've tried the following with the non-existing 'bag', but don't see the error in the Firefox's JavaScript console, which prompts me to think that its not being called. Am I using a wrong protocol for this? The request itself works just fine. (html request) triggerForm: fid; onSuccess: 'bah()'; yourself Cheers! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Lukas Renggli Sent: Tuesday, June 27, 2006 10:49 AM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: Re: [Seaside] [Scriptaculous] Configure element's class frominsidetheupdater? > What an excellent trial-and-error exercise this is, I got the darn thing > folded into one onClick in code, although it does the same thing still :) Yeah, interesting process. I experienced similar trial-and-error exercises ;-) > | fid | > fid := html nextId. > (html form) > id: fid; > with: > [(html checkbox) > value: (self isSelected: row); > callback: [:value | self select: row if: value]; > onClick: > ((html evaluator) > triggerForm: fid; > callback: [:script | ] > value: (html element) > id: row webid; > addClassName: 'selected'; > yourself); > yourself)] they are probably wrong and cause some problems. 2. You don't need "html evaluator" if you don't inject a script into the web-page, just use "html request" for simple requests. 3. The AJAX objects (request, updater, evaluator, etc.) understand a set of events, such as #onComplete:, #onFailure:, #onSuccess:, etc. I would use one of these events (probably #onSuccess:) to change the class of your element. Maybe write a helper function in JavaScript that takes the element and the checkbox as parameters and toggles the classes appropriately. Then you can attach this function to the event handler. Hope this helps, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
In reply to this post by Boris Popov, DeepCove Labs (SNN)
> 3. How do you define onSuccess? I've tried the following with the
> non-existing 'bag', but don't see the error in the Firefox's JavaScript > console, which prompts me to think that its not being called. Am I using a > wrong protocol for this? The request itself works just fine. > > (html request) > triggerForm: fid; > onSuccess: 'bah()'; > yourself 3.1 The arguments passed to JavaScript objects get streamed out using #asJavascript. This means 'blah()' gets transformed to a JavaScript string literal, something you don't want in this case. If you need to put raw code you can replace the string with something like SUStream on: 'bla()' that will answer the right thing. 3.2 Event handlers expect something that can be converted to a function. Most objects can be converted to a function, but sometimes this is not really meaningful. > Hope this helps, > Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Excellent, this works the magic,
(html request) triggerForm: fid; onSuccess: (SUStream on: 'alert("done");'); yourself Thanks! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Lukas Renggli Sent: Tuesday, June 27, 2006 12:05 PM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: Re: [Seaside] [Scriptaculous] Configure element's classfrominsidetheupdater? > 3. How do you define onSuccess? I've tried the following with the > non-existing 'bag', but don't see the error in the Firefox's JavaScript > console, which prompts me to think that its not being called. Am I using a > wrong protocol for this? The request itself works just fine. > > (html request) > triggerForm: fid; > onSuccess: 'bah()'; > yourself 3.1 The arguments passed to JavaScript objects get streamed out using #asJavascript. This means 'blah()' gets transformed to a JavaScript string literal, something you don't want in this case. If you need to put raw code you can replace the string with something like SUStream on: 'bla()' that will answer the right thing. 3.2 Event handlers expect something that can be converted to a function. Most objects can be converted to a function, but sometimes this is not really meaningful. > Hope this helps, > Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
Free forum by Nabble | Edit this page |