Help with updating forms the AJAX way...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with updating forms the AJAX way...

Brian Brown-2
Hey guys,

        Here is the scenario:

I have a component, let's call it ContentEditor, and has a div  
ContentEditorDiv. Inside are two other divs; TreeDiv and ItemEditorDiv.

Tree has a tree component and when an item is clicked on, an instance  
of ItemEditor is rendered to, um, edit that item.

What I would LIKE to do, is submit the form in ItemEditor via ajax,  
also capturing onBlur events so that if someone changes a textInput  
and tabs to another field, that textInput is saved to the Item in  
question.

That by itself works fine, but then I also want to re-render the tree  
with updated text. I thought the easiest way would be to:

html updater
        id: 'ContentEditorDiv';
        triggerFormNamed: 'ItemEditorForm';
        callback: [:r | r render: aContentEditor]

which would tell the whole ContentEditorDiv to re-render. The form  
submits, but the tree never changes. I've tried rendering the Tree  
itself, but it never changes either.

I've gone through various permutations of updater and evaluator, and  
now don't really remember what I did, but I've never been successful  
in getting the Tree to change when the form in ItemEditor is submitted.

I'd be grateful for some help!


Thanks,

Brian

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Help with updating forms the AJAX way...

Lukas Renggli
> which would tell the whole ContentEditorDiv to re-render. The form
> submits, but the tree never changes. I've tried rendering the Tree
> itself, but it never changes either.

What version of Seaside are you on?

Do you happen to backtrack the state of the tree? Usually this does
not work together well with AJAX. This issue has been partly fixed in
later versions of Seaside 2.8, but it still an non obvious cause of
possible problems.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Help with updating forms the AJAX way...

Brian Brown-2
On Sep 26, 2007, at 11:35 PM, "Lukas Renggli" <[hidden email]> wrote:

>> which would tell the whole ContentEditorDiv to re-render. The form
>> submits, but the tree never changes. I've tried rendering the Tree
>> itself, but it never changes either.
>
> What version of Seaside are you on?
>

I'm on the latest 2.8 (... I just updated yesterday from the  
repository) I'm not able to look just now, but it's quite recent.


> Do you happen to backtrack the state of the tree? Usually this does
> not work together well with AJAX. This issue has been partly fixed in
> later versions of Seaside 2.8, but it still an non obvious cause of
> possible problems.
>
No, I'm not bactracking the tree at this point...

> 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
Reply | Threaded
Open this post in threaded view
|

Re: Help with updating forms the AJAX way...

Lukas Renggli
> > Do you happen to backtrack the state of the tree? Usually this does
> > not work together well with AJAX. This issue has been partly fixed in
> > later versions of Seaside 2.8, but it still an non obvious cause of
> > possible problems.
> >
> No, I'm not bactracking the tree at this point...

The next questions then would be ...

1. Does your tree update when you do a full refresh?

2. Does FireBug report any errors or reveal any problems?

3. Can you provide a minimal example that I can file-in and reproduce
the problem with one click?

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Help with updating forms the AJAX way...

Brian Brown-2

On Sep 26, 2007, at 11:48 PM, Lukas Renggli wrote:

>>> Do you happen to backtrack the state of the tree? Usually this does
>>> not work together well with AJAX. This issue has been partly  
>>> fixed in
>>> later versions of Seaside 2.8, but it still an non obvious cause of
>>> possible problems.
>>>
>> No, I'm not bactracking the tree at this point...
>
> The next questions then would be ...
>
> 1. Does your tree update when you do a full refresh?

Yes, the tree updates as normal - for example, if I change an entry  
and then click on another entry, it updates fine.

>
> 2. Does FireBug report any errors or reveal any problems?

I have not looked at it with firebug, so I will do that.

>
> 3. Can you provide a minimal example that I can file-in and reproduce
> the problem with one click?

I will create one :-)

>
> Lukas

Thank you, sir!

>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Help with updating forms the AJAX way...

Brian Brown-2
In reply to this post by Brian Brown-2
Ok, I got through most of this by obeying a few simple things....

I refactored how my render methods relate to the divs I want to  
update: for the method #renderButtonsOn: I would have div called  
'actionButtons'. As long as I initially set it up as:

renderContentOn: html

html div id: 'actionButtons' with: [self renderButtonsOn: html].
...


then I can do things like
        html evaluator
                callback: [:s | s id: 'actionButtons'; render: [:r | self  
renderButtonsOn: r].
                ....

and it works fine. I had things composed so that #renderButtonsOn:  
would look like:

renderButtonsOn: html
        html div id: 'actionButtons';
                with: [html button....]


Trying to update the 'actionButtons' div by calling #renderButtonsOn:  
just doesn't work to well in that case.

I hope this made sense... am I now thinking about this correctly?


Cheers,

Brian

On Sep 26, 2007, at 5:03 PM, Brian Brown wrote:

> Hey guys,
>
> Here is the scenario:
>
> I have a component, let's call it ContentEditor, and has a div  
> ContentEditorDiv. Inside are two other divs; TreeDiv and  
> ItemEditorDiv.
>
> Tree has a tree component and when an item is clicked on, an  
> instance of ItemEditor is rendered to, um, edit that item.
>
> What I would LIKE to do, is submit the form in ItemEditor via ajax,  
> also capturing onBlur events so that if someone changes a textInput  
> and tabs to another field, that textInput is saved to the Item in  
> question.
>
> That by itself works fine, but then I also want to re-render the  
> tree with updated text. I thought the easiest way would be to:
>
> html updater
> id: 'ContentEditorDiv';
> triggerFormNamed: 'ItemEditorForm';
> callback: [:r | r render: aContentEditor]
>
> which would tell the whole ContentEditorDiv to re-render. The form  
> submits, but the tree never changes. I've tried rendering the Tree  
> itself, but it never changes either.
>
> I've gone through various permutations of updater and evaluator,  
> and now don't really remember what I did, but I've never been  
> successful in getting the Tree to change when the form in  
> ItemEditor is submitted.
>
> I'd be grateful for some help!
>
>
> Thanks,
>
> Brian
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

RE: Help with updating forms the AJAX way...

Ramon Leon-5
> Ok, I got through most of this by obeying a few simple things....
>
> I refactored how my render methods relate to the divs I want to
> update: for the method #renderButtonsOn: I would have div
> called 'actionButtons'. As long as I initially set it up as:
>
> renderContentOn: html
>
> html div id: 'actionButtons' with: [self renderButtonsOn: html].
> ...
>
>
> then I can do things like
> html evaluator
> callback: [:s | s id: 'actionButtons'; render:
> [:r | self
> renderButtonsOn: r].
> ....
>
> and it works fine. I had things composed so that #renderButtonsOn:  
> would look like:

Yup, the updaters update the contents of the div, the div itself should not
be re-rendered.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Help with updating forms the AJAX way...

Lukas Renggli
> > then I can do things like
> >       html evaluator
> >               callback: [:s | s id: 'actionButtons'; render:
> > [:r | self
> > renderButtonsOn: r].
> >               ....
> >
> > and it works fine. I had things composed so that #renderButtonsOn:
> > would look like:
>
> Yup, the updaters update the contents of the div, the div itself should not
> be re-rendered.

s is an instance of SUScript. You need to write something like

     s element id: 'actionButtons'; ...

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Help with updating forms the AJAX way...

Brian Brown-2

On Oct 3, 2007, at 6:56 PM, Lukas Renggli wrote:

>>> then I can do things like
>>>       html evaluator
>>>               callback: [:s | s id: 'actionButtons'; render:
>>> [:r | self
>>> renderButtonsOn: r].
>>>               ....
>>>
>>> and it works fine. I had things composed so that #renderButtonsOn:
>>> would look like:
>>
>> Yup, the updaters update the contents of the div, the div itself  
>> should not
>> be re-rendered.
>
> s is an instance of SUScript. You need to write something like
>
>      s element id: 'actionButtons'; ...

Yes, that was a mistake of typing in my email :)



>
> 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