Results 1 to 3 of 3

Thread: form validation question

Hybrid View

  1. #1

    Default 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 at 01:48 PM.

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    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.
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  3. #3

    Default

    Stefan,

    I did try that.

    We are using a dojo button that has an icon.

    fm

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •