[EMAIL PROTECTED] wrote:
I'm having problems with getting the calendar widget to submit upon selecting a date. I've included the <fi:styling submit-on-change="true" /> tag in the form template but this fails to submit the form. I've noticed that it does submit if you manually type a date in the input field so I guess its a problem with the javascript, any suggestions?
Thanks
Will
You can do a document.myformname.submit() after the calendar javascript.
One way to do this is by altering the calendar styling in form-calendar-styling.xsl or take a copy and use a different styling type. Then make sure that at the moment the input element is made and the onclick is set to open the calendar javascript, set the submit rule above, or even better copy the onclick value from fi:styling to the onclick in the input element, after the calendar:
<!-- This datestuff is taken from the original forms-calendar-styling.xsl and altered at the onclick attribute-->
<xsl:template match="fi:field[fi:styling/@type='date-setOnClick']">
<xsl:variable name="id" select="generate-id()"/>
<xsl:variable name="format">
<xsl:choose>
<xsl:when test="fi:[EMAIL PROTECTED]'date']/fi:convertor/@pattern">
<xsl:value-of select="fi:[EMAIL PROTECTED]'date']/fi:convertor/@pattern"/>
</xsl:when>
<xsl:otherwise>yyyy-MM-dd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- regular input -->
<input id="[EMAIL PROTECTED]" name="[EMAIL PROTECTED]" value="{fi:value}" title="{normalize-space(fi:hint)}" type="text">
<xsl:apply-templates select="." mode="styling"/>
</input>
<!-- calendar popup, set the onClick stuff after calendar-->
<a href="#" name="{$id}" id="{$id}" onClick="forms_calendar.select(forms_getForm(this)['[EMAIL PROTECTED]'],'{$id}','{$format}');{fi:styling/@onClick}">
<img src="{$resources-uri}/cal.gif" border="0" alt="Calendar"/>
</a>
<!-- common stuff -->
<xsl:apply-templates select="." mode="common"/>
</xsl:template>
use:
<fi:styling type="date-setOnClick" onClick="dowathever you like eg document.myformname.submit();"/>
and make sure you name your form element
(haven't really tested this submit, but think it should work;-)
Kind Regards, jan
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
