Ah yes, the problem of not catching changes made by clicking on the little
calendar icon.  Here's a crude work-around I'm using in 5.2.6, catching the
click event.

    String scriptlet = "Event.observe('" + dateFieldId + "-trigger',
'click', function() { setChanged(true); });"
    javaScriptSupport.addScript(scriptlet);

I wanted only to detect whether there'd been a change, to protect the user
from leaving the page without saving.  It's not perfect because the user
might click the icon without actually making a change, but for my needs
it's okay.

I left a to-do note to myself a couple of years ago, "The fix might be to
add an unload event on the form that checks whether any of the date values
changed," but I don't know if that still makes sense.


On Mon, Aug 20, 2012 at 6:34 AM, Paul Stanton <p...@mapshed.com.au> wrote:

> I've just tried that too howard,
>
> $("selectedDate").observe("**change", function(event)
>                     {
>                         alert('here');
>                     });
>
> However this is only fired when you type into the input field and the
> click out (blur) .. not when a date is selected via the popup calendar...
>
> I have stepped through the js code via firebug and can see that the jira
> 1844 patch is being executed, however my handler is never called...
>
> if someone could give me a little working eg that would be great!
>
> thanks.
>
>
> On 20/08/2012 4:56 PM, Howard Lewis Ship wrote:
>
>> Have you tried observing the change event? The onchange attr may get
>> overwritten by the date field JS.
>>
>> On Sunday, August 19, 2012, Paul Stanton wrote:
>>
>>  Hi all,
>>>
>>> I've found the bug report: https://issues.apache.org/**
>>> jira/browse/TAP5-1844 
>>> <https://issues.apache.org/**jira/browse/TAP5-1844<https://issues.apache.org/jira/browse/TAP5-1844>
>>> >
>>>
>>> .. and am using tapestry 5.3.3 so the fix has been applied, however I
>>> still can't get tapestry to call my 'onchange' handler.
>>>
>>> <t:datefield value="dateValue" onchange="alert('here');" />
>>>
>>> Is there some extra wiring required?
>>>
>>> Thanks, Paul.
>>>
>>> ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>>
>
> ------------------------------**------------------------------**---------
>
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to