[Seaside] Re: Seaside Async and form submission
Bany, Michel
mbany at cincom.com
Thu Feb 19 14:42:37 UTC 2009
Hi Carl,
I had a look and found a couple of things I would correct in your tiny class.
Note that I was using VW 7.5 together with Seaside 2.6b1.136 and SeasideAsync 1.61
as found on the VW 7.5 distribution.
1. AsyncTest should be a subclass of WAAsyncComponent
2. Method #rendererClass should be removed to inherit from the superclass
Then I found out that #liveCallback: and #submitFormNamed: 'testForm' are conflicting
since both contribute a 'return false' to the onclick event handler.
So I created a fix for you. See ftp://ftp.bany.fr/seaside/ForCarlGundel.zip
This archive includes your tiny class, a fix to WAHtmlAttributes that makes sure
there is only one 'return false' at the very end, and s-unit tests for the fix.
With the fix, your tiny class works fine in FF, but not in Safari. I didn't try in IE.
I'm not sure you tiny class reflects what you are trying to achieve. This tiny class
does something weird, it submits a form and ajax-updates the whole form in the same
javascript handler. I guess you real app is only ajax-updating portions of the form.
Hope this helps,
Michel.
> -----Original Message-----
> From: seaside-bounces at lists.squeakfoundation.org
> [mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf
> Of Carl Gundel
> Sent: mercredi, 18. février 2009 20:43
> To: Carl Gundel
> Cc: Seaside - general discussion
> Subject: [Seaside] Re: Seaside Async and form submission
>
>
> On Feb 18, 2009, at 12:59 PM, Carl Gundel wrote:
>
> > I'm using Async with my Run BASIC project. I am still
> using Seaside
> > 2.6, but I plan to migrate forward as soon as I can get my
> Ajax stuff
> > working okay. have a dynamically generated form with a couple of
> > listboxes and an anchor. When the link is clicked I am
> expecting the
> > values to get scraped from the controls and assigned to my
> model, but
> > it doesn't seem to be happening. The form is getting built and
> > rendered correctly as far as I can tell.
>
> Okay, here is a complete tiny class that seems to exhibit the
> same behavior. The counter increments when the anchor is
> clicked, but the value of selection is always nil.
>
> Any ideas?
>
> -Carl
>
> Smalltalk defineClass: #AsyncTest
> superclass: #{Seaside.WAComponent}
> indexedType: #none
> private: false
> instanceVariableNames: 'list selection counter '
> classInstanceVariableNames: ''
> imports: ''
> category: 'Run BASIC'!
>
> !AsyncTest class methodsFor: 'as yet unclassified'!
>
> canBeRoot
> ^ true!
>
> initialize
> self registerAsApplication: 'asyncTest'.! !
>
> !AsyncTest methodsFor: 'rendering'!
>
> renderContentOn: html
> self renderOnHtml: html!
>
> rendererClass
> ^Seaside.WARenderCanvas!
>
> renderOnHtml: html
> | select anchor |
> html
> text: 'Async test';
> break.
> (html form)
> id: 'testForm';
> with:
> [html
> text: 'Counter = ' ,
> self counter asString;
> break.
> (html div)
> id: 'section';
> with:
> [select
> := html select.
> select
> list: self list.
> select
> on: #selection of: self.
> anchor
> := html anchor.
> anchor
>
> liveCallback:
>
> [:h |
>
> self counter: counter + 1.
>
> self renderOnHtml: h];
>
> submitFormNamed: 'testForm';
>
> text: 'test'.
> html break.
> html
> text: self selection]]! !
>
> !AsyncTest methodsFor: 'accessing'!
>
> counter
> counter isNil ifTrue: [ counter := 0 ].
> ^counter!
>
> counter: anObject
> counter := anObject!
>
> list
> list isNil ifTrue: [ list := OrderedCollection with:
> '1' with: 'one'
> with: 'won' with: 'Juan' ].
> ^list!
>
> list: anObject
> list := anObject!
>
> selection
> ^selection!
>
> selection: anObject
> selection := anObject! !
>
> #{AsyncTest} initialize!
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
More information about the seaside
mailing list