[Seaside] jQuery html rendering

Robert Sirois watchlala at hotmail.com
Tue Jul 14 02:07:55 UTC 2009


Does anyone have any advice for this scenario:



Updating one object via an ajax form, but with the ability to create new form elements on the fly.



It should work a little like this:



I fill out a form input, hit a button, and another appears. Fill out
the new one, hit a button, etc., etc. Each time the button is pushed
that element would be saved.



Thanks,

RS

> Date: Sun, 12 Jul 2009 22:09:03 +0100
> Subject: Re: [Seaside] jQuery html rendering
> From: jfitzell at gmail.com
> To: seaside at lists.squeakfoundation.org
> 
> It may work sometimes, but certain things will not work. #updateRoot:
> for example, will not be called for that component or any component
> contained within it. In 2.8, I think callbacks won't work for those
> components.
> 
> Even lazy initialization is not really good enough - it may work
> sometimes but updateRoot: and others certainly won't be called during
> the first request. Also, you shouldn't modify backtracked component
> state during rendering, so you may need to be careful there when using
> lazy initialization too (off the top of my head, I can't remember if
> that same restriction applies during javascript rendering callbacks,
> though - it may not).
> 
> I'm not certain that these things are causing your problems, but it's
> the most obvious thing that jumps out at me. If you aren't persisting
> the components, you really don't need a component. In 2.9, make a
> subclass of WAPainter instead - those don't need to be persisted. In
> 2.8, you could try just subclassing Object and implementing #renderOn:
> but it may or may not give you everything you need.
> 
> If making that change fixes your problem (or you discover that you
> *do* need components and therefor *do* need to be persisting them)
> then we've found the issue. Otherwise, if you prepare a simple example
> that we can file in and debug someone may be able to help further.
> 
> Julian
> 
> On Sun, Jul 12, 2009 at 7:18 PM, Robert Sirois<watchlala at hotmail.com> wrote:
> > Thanks, Julian. I am a bit confused, though.
> >
> >     html anchor
> >         onClick: ((html jQuery: '#contentArea') html: [:r | r render:
> > (RPSSCreator new)]);
> >         with: 'Create a new survey'.
> >
> > I have been using code like this in a few areas, and it works just fine. The
> > object just needs to persist until it does its job, then I can move along in
> > whatever process.
> >
> > I can't seem to get some of my components to render in this way... I get:
> > 'MessageNotUnderstood: RPSSSurveyItemComponent>>nil'. As far as I can tell,
> > there is nothing different about it (than the others), and I am not sending
> > any messages to it except #new. WACounter, etc. work fine in its place.
> >
> > As far as #children goes, I havn't been including everything there because
> > the page is remaining relatively static. 'RPSSSurveyItemComponent' is a
> > WAComponent subclass, but I'm just using it to generate survey components,
> > so for each new survey item I will need a new instance.
> >
> > Is lazy initializing good enough for creating these objects in advance when
> > it comes to jQuery?
> >
> > Thanks,
> > RS
> >
> >> Date: Sun, 12 Jul 2009 08:22:03 +0100
> >> Subject: Re: [Seaside] jQuery html rendering
> >> From: jfitzell at gmail.com
> >> To: seaside at lists.squeakfoundation.org
> >>
> >> Components are persistent objects. You can't create them on the fly as
> >> throw-aways (in particular they need to be returned from your
> >> #children method). See the recent discussion about components,
> >> painters, and renderable objects on this list.
> >>
> >> You either need to create the component earlier and store it somewhere
> >> or not use a component here (if you don't need the object to persist,
> >> you don't need a component).
> >>
> >> Julian
> >>
> >> On Sun, Jul 12, 2009 at 12:25 AM, Robert Sirois<watchlala at hotmail.com>
> >> wrote:
> >> > clickFunctionNew: html
> >> >         ^((html jQuery: '#newArea') html: [:r | r render:
> >> > ((RPSSSurveyItemComponent new) newInputOn: self inputType; yourself)]).
> >> >
> >> > Could someone please explain to me why this does not work? If I replace
> >> > the
> >> > class 'RPSSSurveyItemComponent' with some like a string 'blah', it runs
> >> > fine. Am I to understand that I cannot render components (the
> >> > aforementioned
> >> > class is a WAComponent subclass with the proper 'renderContentOn:'
> >> > method)
> >> > like a can do with standard Seaside callbacks?
> >> >
> >> > Thanks!
> >> >
> >> > RS
> >> >
> >> > ________________________________
> >> > Windows Live™: Keep your life in sync. Check it out.
> >> > _______________________________________________
> >> > seaside mailing list
> >> > seaside at lists.squeakfoundation.org
> >> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >> >
> >> >
> >> _______________________________________________
> >> seaside mailing list
> >> seaside at lists.squeakfoundation.org
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> > ________________________________
> > Lauren found her dream laptop. Find the PC that’s right for you.
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_________________________________________________________________
Lauren found her dream laptop. Find the PC that’s right for you.
http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090713/26dc4fd4/attachment.htm


More information about the seaside mailing list