Thanks Jan for your suggestion.

However this seems to submit the form when clicking on the calendar icon and before having chance to select a date from the calendar widget - I've included the html output below.

<input type="text" title="" value="" name="date" id="date" id="N10032" name="N10032" href="" alt="Calendar" border="0" src="">
I feel the problem lies in the fact that the input field's onChange event does not get called if it's value is modified via _javascript_.


Will





Jan Hoskens <[EMAIL PROTECTED]>

20/10/2004 07:43

Please respond to
[EMAIL PROTECTED]

To
[EMAIL PROTECTED]
cc
Subject
Re: Problems with submit-on-change for the calendar widget





[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}"
PROTECTED]'],'{$id}','{$format}');{fi:styling/@onClick}">
               <img src="" border="0"
alt="Calendar"/>
           </a>
           <!-- common stuff -->
           <xsl:apply-templates select="." mode="common"/>
       </xsl:template>

use:
<fi:styling type="date-setOnClick" 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]


Reply via email to