[Seaside] Handling and avoiding nested forms

Michel Bany michel.bany at gmail.com
Mon Aug 25 06:56:03 UTC 2008


Package SeasideAssistants in squeaksource.com/Seaside does exactly  
what you are looking for.
It also detects duplicate id= attributes.
See below the VisualWorks package comment that provides some usage  
guidelines.
Unfortunately, it is for Seaside 2.7 and has not been updated for  
2.8. As a matter of fact it doesn't even load in a Seaside 2.8 image.
Cheers,
Michel.

SeasideAssistants for VisualWorks

Among other things, proper compliance to XHTML implies
(1) Form tags are not be nested,
(2) The id attribute values are unique.
The later is especially important when using AJAX techniques where it  
is critical for the Javascript functions to uniquely identify the XML  
elements that are manipulated.
In complex constructs that are using many nested components generated  
by many different rendering methods from many different classes, it  
may be difficult to ensure XHTML compliance. As a consequence, nested  
form tags or duplicate id attribute values are likely to occur.
This package slightly modifies Seaside so that nested form tags and  
duplicate id attribute values are producing an error. This makes it  
possible to immediately and precisely spot where to look in the  
Seaside application.
The exact behavior is decided in the following methods :
	#shouldRaiseDuplicateCssIdErrors
	#shouldRaiseNestedFormErrors
	#shouldSilentlyDiscardNestedForms
These methods are available in classes WAHtmlRenderer and  
WARenderCanvas.
When this package is loaded the default behavior is the following:
(1) Duplicate id attribute values are allowed  
(#shouldRaiseDuplicateCssIdErrors answers false)
(2) Nested form tags are allowed (#shouldRaiseNestedFormErrors  
answers false)
(3) Nested form tags are silently discarded  
(#shouldSilentlyDiscardNestedForms answers true)
This default behavior ensures that an existing Seaside application  
does not break.
To enable a different behavior, there are two possibilities.
(1) Modifies any of the six methods listed above
(2) Subclass WAHtmlRenderer or WARenderCanvas and re-implement  
methods as needed
Contributors: Michel Bany

Keywords: Web, Continuations, HTML, XHTML, CSS, Internet, Squeak

Port from SeasideAssistants-mb.12.mcz      24 July 2007 3:13:27 pm


On Aug 24, 2008, at 10:08 AM, Hwee-Boon Yar wrote:

> Has anyone develop a good approach to handling and/or avoid nested  
> forms?
>
> -- 
> Hwee-Boon
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list