cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Morandini <lmorand...@ieee.org>
Subject Re: [2.2] Forms dependency on Ajax block
Date Thu, 13 Mar 2008 21:09:27 GMT
Grzegorz Kossakowski wrote:
> Luca Morandini pisze:
>>
>> I presume that a way to disentangle forms and ajax blocks would be to
>> make two different forms-field-styling.xsl (one with Javascript and/or
>> Ajax, the other without Javascript), loaded conditionally on ajax="true"
>> by forms-samples-styling.xsl.
> 
> That would be quite difficult because there is no easy way to conditionally load XSL
templates. 

Gee... yes, that's one of the things XSLT is not supposed to do.


> What
> about making inclusion of JS libraries in generated HTML forms conditional? It would
only require
> tweaking existing templates.

Dropping libraries is easy, what's not so easy is the dropping of the 
Javascript code poping up here and there.

Another solution would be to make every template "dual":
<xsl:template match="fi:validation-message">
	<xsl:choose>
		<xsl:when test="$ajax-mode='true'">
			<span dojoType="forms:infopopup"
			...
			</span>
		</xsl:when>
		<xsl:otherwise>
			<span style="display:none"
			...
			</span>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

Come to think of it, there should be three modes, not teo: ajax, 
javascript, no-javascript.
Hence, ajax='true' should be changed too, maybe to 
client='static|dynamic|ajax'... hmm... the matter is getting hairy.

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


Mime
View raw message