Sorry I seem to keep losing my message text in the email :P --------------- I've boiled my question down to this... What's the best way to have an editor component retain the values of it's input fields, if those values have been changed, and nested components are calling editors of their own? An example scenario: I have a customer editor component that has a name input, and a nested phone number report component. Each report row has a phone number, type, and "Add" link. When it is clicked the report component calls and is replaced by a phone number editor component. This is happening within the customer editor. The problem is that when the phone number editor component is called, the value of the name input field in the customer editor reverts to it's original value if it had been changed. If it had a value of "Lenny" when the form renders, and the user changes the name to "Carl". It changes back to "Lenny" when the user goes to add a phone number. I get that when the anchor is clicked the form refreshes. So is ajax the answer? Or can I take a different approach with components? I have an .mcz of my test case that I tried to attach but I think it was messing up my post. Thanks Joel _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Joel,
You probably should give some details as to which Smalltalk, which version of Seaside etc. I could not get the mcz package to load so I am going by what I can glean from viewing the changes in your package. There are a bunch of rendering methods that got added to the class side somehow that I think is the cause of the failure to load. Try removing them and repackaging your code. Usual usage for a report of items like the phone report is to put an Add button somewhere other than on the row of the existing item (other wise how would one be able to add the first phonenumber). The Add button should "call" the phone editor: self call: PhoneEditor. The phone editor would return a Phone object instead of true or false so the call then looks like p := self call: phoneEditor. p isNil ifFalse: [ phones add: p ]. And your phone editor should answer: phone instead of true/false The PhoneReport is a child of the Customer editor, so calling the PhoneEditor in this manner should only replace the Phone report not the Customer component. This way the Customer data does not "disappear". Why it is not doing that I cannot tell since I cannot run the code. Hope this helps John On Mon, May 25, 2009 at 8:26 AM, Joel Turnbull <[hidden email]> wrote:
-- http://jmck.seasidehosting.st _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Mon, May 25, 2009 at 11:54 AM, John McKeon <[hidden email]> wrote: Joel, Thanks John. Using Pharo Web Image 09.04.6, and the Seaside that came packaged up with that ( not sure how to check the version ).
That's a good tip thanks. The control is a meant to be little more sophisticated and can actually add a new phone number between two phone numbers, it adds a new phone number under whichever row you click "Add" on. I don't have it coded in, but if there are no phone numbers yet, then the report would be simply be an "Add Phone Number" link.
I'm glad to hear that's what it should do, now it's just a matter of figuring out what strange thing I did to make it NOT do that. I cleaned up those class methods and there was a halt in there too that shouldn't have been. Attaching the .mcz seemed to be giving me problems this morning so I just put it here for download: http://www.joelturnbull.com/JLLT-EditorsTest-JLL.2.mcz It's just a test case with a method that creates a sample customer...doesn't persist anything...it just demos the problem I'm having.
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
That package throws even bigger errors with CRCError doesnt understand proceed or some such.
I think I have spotted your problem being that you use an anchor to call the PhoneAdder component and that doesn't perform the submit so the customer name change doesn't get updated before the whole thing gets rerendered. If you use a submitButton the submit DOES get performed and your model should get updated. Look at the Form notes in WAFormInputTag. Warm regards John On Mon, May 25, 2009 at 6:37 PM, Joel Turnbull <[hidden email]> wrote:
-- http://jmck.seasidehosting.st _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Bingo! Makes a lot of sense. Thanks John! Joel On Mon, May 25, 2009 at 9:26 PM, John McKeon <[hidden email]> wrote: That package throws even bigger errors with CRCError doesnt understand proceed or some such. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |