[Seaside] Nested form tags
m.bany at wanadoo.fr
Thu Nov 3 22:56:04 CET 2005
I believe I found the bug that causes the weird effects that have been
observed when nesting forms.
When there are nested <form> in the html and when a submit button is
pressed, the resulting http
request contains the "_s" and the "_k" hidden fields many times (once
for each form).
As a result the http fields in the request are holding collection of
strings rather than just strings
(the field dictionary object is too smart !) In such situations, Seaside
is not able to retrieve the
session and shows the expiration screen.
I found that the consequences of the bug can be in corrected
where the request fields can be computed differently. The implementation
in the attachment
eliminates the false expiration.
This does not occur in VisualWorks where the computation of the request
fields are always
and consistently available as collections or strings.
The attached change set includes both the fix and a test component with
-------------- next part --------------
'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 3 November 2005 at 10:28:53 pm'!
WAComponent subclass: #WANestedForms
!WAKom methodsFor: 'as yet unclassified' stamp: 'mb 11/3/2005 22:28'!
| request fields waFields |
self processMultipartFields: aKomRequest.
fields := aKomRequest method = 'POST'
ifTrue: [aKomRequest postFields]
ifFalse: [aKomRequest getFields].
waFields := Dictionary new.
keysAndValuesDo: [:k :v | v isString
ifFalse: [waFields at: k put: v first]
ifTrue: [waFields at: k put: v]].
request := WARequest
method: aKomRequest method
url: aKomRequest url unescapePercents
headers: aKomRequest header
cookies: aKomRequest cookies
aKomRequest method = 'PUT'
ifTrue: [request fields
put: (aKomRequest stream next: aKomRequest contentLength)].
^ request! !
!WANestedForms methodsFor: 'rendering' stamp: 'mb 11/3/2005 22:17'!
html heading: 'Buttons in nested forms'.
html text: 'Click the buttons and get an expired session !!'.
submitButtonWithAction: [self inform: 'Button1']
submitButtonWithAction: [self inform: 'Button2']
text: 'Button2']]! !
!WANestedForms class methodsFor: 'initialize-release' stamp: 'mb 11/3/2005 22:13'!
self registerAsApplication: 'NestedForms'! !
!WANestedForms class reorganize!
More information about the Seaside