You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jonathan O'Connor (JIRA)" <ta...@jakarta.apache.org> on 2005/03/01 20:04:48 UTC
[jira] Commented: (TAPESTRY-238) DatePicker not calling onchange on text edit, after setting a new value.
[ http://issues.apache.org/jira/browse/TAPESTRY-238?page=comments#action_59968 ]
Jonathan O'Connor commented on TAPESTRY-238:
--------------------------------------------
Actually, the code I added to the DatePicker has introduced a bug. If you do not define an onchange="blah()" attribute on the DatePicker, then (at least in FireFox), the DatePicker will not close when you click on a date.
The workaround is to add onchange="" attribute.
E.g.
<input type="text" jwcid="@DatePicker" value="ognl:birthday" onchange=""/>
The Javascript solution is to check if the onchange method exists.
DatePicker.script needs to be changed from the old:
${calendarObject}.onchange = function() {
document.${formName}.${name}.value = ${calendarObject}.formatDate();
document.${formName}.${name}.onchange();
}
to
${calendarObject}.onchange = function() {
document.${formName}.${name}.value = ${calendarObject}.formatDate();
if (typeof document.${formName}.${name}.onchange == "function") {
document.${formName}.${name}.onchange();
}
}
Many apologies to everyone for this problem. My level of Javascript is obviously "Danger to self and others".
> DatePicker not calling onchange on text edit, after setting a new value.
> ------------------------------------------------------------------------
>
> Key: TAPESTRY-238
> URL: http://issues.apache.org/jira/browse/TAPESTRY-238
> Project: Tapestry
> Type: Bug
> Components: Contrib
> Versions: 3.0.1, 3.0
> Reporter: Jonathan O'Connor
>
> Steps to reproduce:
> 1. Create a page with a DatePicker component.
> 2. Add an onchange JavaScript call to the DatePicker. E.g.
> <span jwcid="@DatePicker" value="ognl:dateValue"
> onchange="handleDateChanged()">
> <input type="text" value="Day Month Year"/>
> </span>
> 3. Click on the Calendar control and change the date.
> Result:
> The text field is updated, but the handleDateChanged() method is not called.
> Expected Result:
> The text field is updated, AND the handleDateChanged() method IS called.
> Fix:
> Change the DatePicker.script in framework/src/org.apache/tapestry/form.
> ${calendarObject}.onchange = function() {
> document.${formName}.${name}.value = ${calendarObject}.formatDate();
> document.${formName}.${name}.onchange(); /* New line invokes the onchange method */
> }
> This works on both Firefox and IE 6.0. It also works when there is no onchange method set.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org