Announcement Announcement Module
Collapse
No announcement yet.
form validation question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • form validation question

    Roo generated code... for form:create.tagx

    Code:
    <div class="submit" id="${fn:escapeXml(id)}_submit">
              <spring:message code="button_save" var="save_button"/>
              <script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));</script>
              <input id="proceed" type="submit" value="${fn:escapeXml(save_button)}"/>
    </div>
    I need a Dojo button

    So I add a Spring decoration to the button.

    Code:
    <script type="text/javascript">
        dojo.require("dijit.form.Button");
      </script>
    Code:
    <div class="submit" id="${fn:escapeXml(id)}_submit">
              <spring:message code="button_save" var="save_button"/>
              <script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));</script>
              <input id="proceed" type="submit" value="${fn:escapeXml(save_button)}"/>
    
    <!-- Added this -->
    
    <script type="text/javascript">
                 Spring.addDecoration(new Spring.ElementDecoration({elementId : 'proceed', widgetType : 'dijit.form.Button', 
                	 widgetAttrs : { label: '${fn:escapeXml(save_button)}'}
      		       })); 
               </script>
    </div>
    Submitting an empty form by adding this decoration submits the form instead of flagging errors...

    any ideas?

    Thanks,

    fm
    Last edited by fastmap; Mar 30th, 2011, 01:48 PM.

  • #2
    I guess you need to register an onclick event for your button to hook into the validate all decoration. You can also try to change the sequence in which you declare the button and the validate all decoration.

    Why do you need a special dojo button in the first place? The create form already offers a CSS styled button.

    Comment


    • #3
      Stefan,

      I did try that.

      We are using a dojo button that has an icon.

      fm

      Comment

      Working...
      X