[Xsltforms-support] Fwd: select1 selection="open"
Brought to you by:
alain-couthures
|
From: Benoit V. <bvi...@la...> - 2014-11-08 11:10:14
|
Hi Alain,
It would be very useful for our application to have the <xf:select1
selection="open" /> implemented in XSLTForms. I searched on the web
and found that, now, with HTML 5 it's very easy to have a combobox
without coding anything in javascript :
example :
<input type="text" list="browsers" />
<datalist id="browsers" >
<option> Google </option>
<option> IE9 </option>
</datalist>
I think it could be possible to implement <xf:select1 selection="open" /> in XSLTForms by merging the existing code of xf:input (for the field)
and the xf:select1 (for the options list). I tried some quick and dirty tests and it seems to work for modern browsers.
I try to generate the HTML with a template like this :
<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" match="xforms:select1[@selection='open']" priority="3">
<xsl:param name="appearance" select="false()"/>
<xsl:param name="parentworkid"/>
<xsl:param name="workid" select="concat(position(),'_',$parentworkid)"/>
<xsl:call-template name="field">
<xsl:with-param name="workid" select="$workid"/>
<xsl:with-param name="appearance" select="$appearance"/>
<xsl:with-param name="body">
<input type="text" list="datalist-{$workid}">
<xsl:call-template name="comun"/>
</input>
<datalist id="datalist-{$workid}">
<xsl:apply-templates select="node()" mode="item">
<xsl:with-param name="parentworkid" select="$workid"/>
</xsl:apply-templates>
</datalist>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
but I have not enough skills to modify the javascript generation code. I'm stuck !
Do you think that it would be possible to have this feature in XSLTForms (at least for HTML 5 browser)?
Thank you for your help.
Benoit
|