Announcement Announcement Module
Collapse
No announcement yet.
Dojo -- TimeTextBox Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dojo -- TimeTextBox

    I am working on building an input form similar to the booking example in the reference project, however instead of the Date widget I am trying to use the Time widget. I believe I have my widget set-up correctly to display because when I do not specify a 'value' the widget appears normally.

    If I try to specify the value either by the backing form:input tag or through the value widgetAttrs the resulting page blows up. The fire bug error is

    Code:
    842.getHours is not a function
     (function(){var _1=null;if((_1||(typeof ...tTimeout(dojo._fakeLoadInit,1000);}})(); dojo.js (line 16)
    I am using a property editor for my form object variable
    Code:
    registry.registerCustomEditor(Time.class, new CustomDateEditor(new SimpleDateFormat("HH:mm:ss"), false));
    The format of the editor matches the time pattern specified by the JS widget

    Code:
    <form:input path="minStartTime"/>
    <script type="text/javascript">
      Spring.addDecoration(new Spring.ElementDecoration({
        elementId : "minStartTime",
        widgetType : "dijit.form.TimeTextBox",
        widgetAttrs : {constraints:{timePattern:"HH:mm:ss", clickableIncrement:"T00:15:00", visibleIncrement:"T00:15:00", visibleRange:"T02:00:00"}}
      }));  
    </script>
    Here is the rendered HTML of the input tag
    Code:
    <input id="minStartTime" name="minStartTime" type="text" value="14:33:11"/>
    Am I missing something in the set-up or execution? Any help is greatly appreciated.

    -jason

  • #2
    Hi Jason,

    I happened to be doing similar things with TimeTextBox widgets myself and ran across a piece of the Dojo API (on dojocampus.org) that indicated that the latest version of the Dojo API does not support a timePattern attribute for dijit.form.TimeTextBox. This may explain why the resulting page is blowing up. According to the API, TimeTextBox only supports a single format : "THH:mm:ss". You can read the page on dojocampus.org to check this. I also happened to run across an edge case where not specifying a widgetAttrs property causes the form item to be improperly decorated and set the wrong 'name' attribute on pages where there's more than one TimeTextBox widget, so watch out for that as well

    Comment


    • #3
      OK, so after my last post, I was tweaking the tag library I'm writing for Spring Webflow 2 JS decorations, and I ran across *exactly* the same problem you're having. After a couple hours debugging and swapping out the Spring decorations for their direct Dojo declarations right on the element (doesn't generate W3C compliant XHTML, but whatever at this point), I've tracked the bug down to Spring JS, not Dojo itself. I'll keep working on this problem, and if I find a solution, I'll post it to this thread.

      Comment


      • #4
        Ok, so I found the root of the problem, and it's that the Spring.ElementDecoration.apply function doesn't properly setup the decorated TimeTexBox widget as it does the DateTextBox widget. I've created a patch for this and submitted it under http://jira.springframework.org/browse/SJS-29 in the Spring JIRA issue tracker. You can patch your version of Spring-Dojo.js and use that for TimeTexBoxes.

        Comment

        Working...
        X