On Fri, Mar 14, 2008 at 11:00 AM, Stephan Koch
<[EMAIL PROTECTED]> wrote:
> So basically I could subclass DatePicker and override
>  getAdditionalJavascript to inject some Js that triggers the onchange
>  event in DateTextField when some useful event in DatePicker fires.

thats the idea.

>  I also found the appendToInit method below, but that method is never
>  called in DatePicker. Would that be a bug?

yes, please file a jira issue

-igor

>
>  --stephan
>
>  /**
>      * Append javascript to the initialization function for the YUI
>  widget. Can be used by
>      * subclasses to conveniently extend configuration without having to
>  write a separate
>      * contribution.
>      *
>      * @param markupId
>      *            The markup id of the calendar component
>      * @param javascriptId
>      *            the non-name spaced javascript id of the widget
>      * @param javascriptWidgetId
>      *            the name space id of the widget
>      * @param b
>      *            the buffer to append the script to
>      */
>     protected void appendToInit(String markupId, String javascriptId,
>  String javascriptWidgetId,
>             StringBuffer b)
>     {
>     }
>
>  /**
>      * Override this method to further customize the YUI Calendar with
>  additional Javascript code.
>      * The code returned by this method is executed right after the
>  Calendar has been constructed
>      * and initialized. To refer to the actual Calendar DOM object, use
>  <code>${calendar}</code>
>      * in your code.<br/>See <a
>  href="http://developer.yahoo.com/yui/calendar/";>the widget's
>      * documentation</a> for more information about the YUI
>  Calendar.<br/> Example:
>      *
>      * <pre>
>      * protected String getAdditionalJavascript()
>      * {
>      *     return &quot;${calendar}.addRenderer(\&quot;10/3\&quot;,
>  ${calendar}.renderCellStyleHighlight1);&quot;;
>      * }
>      * </pre>
>      *
>      * @return a String containing additional Javascript code
>      *
>      */
>     protected String getAdditionalJavascript()
>     {
>         return "";
>
>
>     }
>
>  Igor Vaynberg wrote:
>  > i dont think values changed via js send out onchange events. you will
>  > probably need to hook into the datepicker javascript and invoke
>  > onchange explicitly. fortunately yui stuff has a pretty good event
>  > system that widgets use, so plugging into it should probably not pose
>  > a huge problem.
>  >
>  > -igor
>  >
>  >
>  > On Fri, Mar 14, 2008 at 9:56 AM, Stephan Koch
>  > <[EMAIL PROTECTED]> wrote:
>  >
>  >> Hi all,
>  >>
>  >>  I'm currently having some trouble with a DateTextField. The
>  >>  DateTextField has a DatePicker component attached to it.
>  >>  Once the user changes the date with the DatePicker, the attached
>  >>  DateTextField is assigned the new date and should trigger the onChange
>  >>  event. Which it doesn't do....
>  >>
>  >>  Everything works fine if the date is changed by typing directly it into
>  >>  the textfield. Any ideas?
>  >>
>  >>
>  >>
>  >>
>  >>  DateTextField dtf  = DateTextField.forShortStyle("dateField", new
>  >>  PropertyModel(this, "date"));
>  >>
>  >>  dtf.add(new DatePicker());
>  >>
>  >>  OnChangeAjaxBehavior dateOnChange = new OnChangeAjaxBehavior() {
>  >>
>  >>             @Override
>  >>              protected void onUpdate(AjaxRequestTarget target) {
>  >>                  log.debug("dateField onChange event triggered.");
>  >>                 // do some stuff with the date here...
>  >>              }
>  >>
>  >>  };
>  >>
>  >>  dtf.add(dateOnChange);
>  >>  add(dtf);
>  >>
>  >>
>  >>  --Stephan
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >>  For additional commands, e-mail: [EMAIL PROTECTED]
>  >>
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to