cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Problems with submit-on-change for the calendar widget
Date Wed, 20 Oct 2004 11:14:49 GMT
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="#"><img alt="Calendar" border="0" 

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.


Jan Hoskens <> 
20/10/2004 07:43
Please respond to


Re: Problems with submit-on-change for the calendar widget 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:variable name="id" select="generate-id()"/>
            <xsl:variable name="format">
            <!-- regular input -->
            <input id="{@id}" name="{@id}" value="{fi:value}" 
title="{normalize-space(fi:hint)}" type="text">
                <xsl:apply-templates select="." mode="styling"/>
            <!-- calendar popup, set the onClick stuff after calendar-->
            <a href="#" name="{$id}" id="{$id}" 
                <img src="{$resources-uri}/cal.gif" border="0" 
            <!-- common stuff -->
            <xsl:apply-templates select="." mode="common"/>

 <fi:styling type="date-setOnClick" onClick="dowathever you like eg 
and make sure you name your form element

(haven't really tested this submit, but think it should work;-)

Kind Regards,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message