[Seaside] Glorp-Seaside-callback not Working

Rajeev Lochan lochan94 at gmail.com
Sun Aug 12 16:53:01 UTC 2007


Hi Ron,
I tried to implement what you hinted, no progress.

I changed my code to

html
        form: [self session
                commit: [temp := self session
                                readOneOf: BlogPost
                                where: [:each | each persistentId = '1'].
                    self session register: temp.
                    html textInput value: temp title;

                        callback: [:value | temp title: value].
                    html submitButton
                        callback: [self session register: temp];
                         text: 'Update']]


I am registering before change as you said, but doesnt change the title. (I
am registering twice though)


But, even if I dont register the object, before changing. It does update if
I use normal setter technique. (Snippet below)

html
        form: [self session
                commit: [temp := self session
                                readOneOf: BlogPost
                                where: [:each | each persistentId = '1'].
                    temp title: 'some Title'.
                    html submitButton
                        callback: [self session register: temp];
                         text: 'Update']]




In Glorp Tutorial by Roger Whitney, he updated in just unitOfWork and also
without registering it.

"   A UnitOfWork will keep track of the changes we make in objects. The
following will retrieve a
person, change the first name of person and then write the changes back to
the database.

session beginUnitOfWork.
foundPerson := session readOneOf: Person where: [:each | each firstName =
'Jose'].
foundPerson firstName: 'RamJet'.
session commitUnitOfWork

When we start a UnitOfWork it records all the objects we read from the
database. When the
UnitOfWork is committed it writes all the changed objects back to the
database."


As much I understand, it has something to do with
self session commit:[ ........... html textInput value: callback:
...........]


BTW, I am not using Magritte in my proposed application. So Ramon's Active
Record for Magritte would possibly not help me much.

Thanks in advance.


On 8/12/07, Ron Teitelbaum <Ron at usmedrec.com> wrote:
>
>  Hi Rajeev,
>
>
>
> You need to register the object before you make changes to it.  The
> registration tells Glorp to track changes to your object.
>
>
>
> Hope that helps!
>
> Ron Teitelbaum
>
>
>   ------------------------------
>
> *From:* seaside-bounces at lists.squeakfoundation.org [mailto:
> seaside-bounces at lists.squeakfoundation.org] *On Behalf Of *Rajeev Lochan
> *Sent:* Sunday, August 12, 2007 11:52 AM
> *To:* Seaside - general discussion
> *Subject:* [Seaside] Glorp-Seaside-callback not Working
>
>
>
> Dear Seasiders,
> I followed Ramon's Blog of porting seaside to postgreSQL using Glorp.
> I have now created 2 components. In one, you can enter the details of the
> form (which are in the form of textInput and textArea) and are registered
> upon submitting a button. This part works well.
>
> Now, in the second component, I want to edit(update) the entries I have
> created earlier. I use textInput and textArea again for this, and when I
> edit and submit using a button (register the model) , the update doesnt seem
> to work.
>
> I have observed one thing here, the update doesnt seem to work in
> textInput value: callback:
>
> A snippet is code is here.(which doesnt update the title)
>
>
> self session
>         commit: [temp := self session
>                         readOneOf: BlogPost
>                         where: [:each | each title = '1'].
>                        html textInput value: temp title;
>                         callback: [:value | temp title: value].
>                          self session register: temp]
>
>
>
> A snippet which uses simple setter technique and is updated.
>
> self session
>         commit: [temp := self session
>                         readOneOf: BlogPost
>                         where: [:each | each title = '1'].
>                         temp title: 'some Title'.
>                         self session register: temp].
>
>
>
> Anticipating your help
>
>
>
>
> --
> Rajeev Lochan
>
> Co-founder, AR-CAD.com
>
> http://www.ar-cad.com
> +91 9243468076 (Bangalore)
> 080 65355873
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


-- 
Rajeev Lochan

Co-founder, AR-CAD.com

http://www.ar-cad.com
+91 9243468076 (Bangalore)
080 65355873
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070812/b2242bb2/attachment.htm


More information about the seaside mailing list