cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject [cforms] upload widget styling
Date Thu, 29 Apr 2004 18:53:54 GMT
(I'm posting this on the dev list because I may end up filing something 
on Bugzilla, but I wanted to talk it over first...)

Anyway.... I'm not getting the idea of what forms-field-styling.xsl is 
trying to do with <fi:upload>... all I know is that it's not what I 
need! :-)

   <xsl:template match="fi:upload">
     <xsl:choose>
       <xsl:when test="fi:value">
         <!-- Has a value (filename): display it with a change button -->
         <span title="{fi:hint}">
           [<xsl:value-of select="fi:value"/>] <input type="submit" 
id="{@id}" name="{@id}" value="..."/>
         </span>
       </xsl:when>
       <xsl:otherwise>
         <input type="file" id="{@id}" name="{@id}" title="{fi:hint}" 
accept="{@mime-types}"/>
       </xsl:otherwise>
     </xsl:choose>
     <xsl:apply-templates select="." mode="common"/>
   </xsl:template>

My form has an action widget whose handler cares about the value of the 
upload widget (this handler does the upload).  So when the form is 
redisplayed, I no longer get an <input type="file">, instead I get a 
submit button (!).

This handling of fi:upload was obviously designed to support some 
scenario, but it's undocumented and (a)  obvious to me what that might 
be, and (b) as I mentioned, it doesn't fit what I'm trying to do.

I tried to defeat this behavior by doing this immediately before 
exiting my action widget handler:

	wid.logoFile.value = null;

...but that loses: "value of <fd:upload> widget cannot be manually 
set", or something to that effect.

I would petition that the default handling of <fi:upload> should always 
just generate an <input type="file">, and let the special handling that 
is the current default be selected using an <fi:styling> attribute.

Or, that it  be allowed to set the value of an upload widget to null 
(fine with me if setting it to a non-null value were disallowed).

WDYT?
mark


Mime
View raw message