Easy way to Validate all before submit enabled? - InfoPath Dev
in

InfoPath Dev

Easy way to Validate all before submit enabled?

Last post 05-25-2007 11:51 AM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-23-2007 02:25 PM

    Easy way to Validate all before submit enabled?

    I've checked and rechecked within the forums, but I can't find a topic or string that helps.

    I want to either disable the Submit button or hide the section that houses the Submit button unless all the required fields on the form are completed.  There are many required fields within different sections, but they are required only when those sections are visible to the user when they select a specific checkbox to unhide that section.  My difficulty is that I can figure out how to disable or hid the Submit button if ONE of the sections and it's required fields fail validation, but I can't get this to work if I try and validate the fields in more that one section on the form......the Submit button remains disabled regardless of whether or not the required fields are completed.

    Is there a way I can easily validate ALL required fields before enabling the Submit button?  I would want something like this:

    1. Button "Review the form for errors"
    2. If any error found display message "There are validation errors on the form.  These errors must be corrected BEFORE the Submit button will be enabled and the form can be submitted."
    3. 1. and 2. above would continue as many times as the user clicks on the "Review for errors" button until the # of errors = 0
    4. When # of errors = 0 then Submit button is enabled and the form can be submitted

    Any help is greatly appreciated.  Also, please note that I have zero eperiencing with writing either VBS or JS code.

  • 05-24-2007 10:41 AM In reply to

    Re: Easy way to Validate all before submit enabled?

    You basically have it. The one condition is that you must use code. There is an Errors collection--check to see whether there are zero errors. Errors occur because required fields (red asterisks) are not filled in or because of invalid data (text in a date picker field). This soundsl like all you need.

    There is a way to call into code from conditional formatting. See: http://www.infopathdev.com/blogs/greg/archive/2004/09/15/Use-Code-to-Determine-a-Rule-Condition.aspx for more details on how to do this. This would allow you to disable

    However, why have 2 buttons -- one to check and a disabled submit? Just use the one submit button. When they click that the code checks for errors, then gives them the error message and does not proceed to submit. When all the errors are fixed the submit succeeds. Seems silly to me to have a second button to review for errors, but you might have other reasons.

  • 05-25-2007 09:51 AM In reply to

    Re: Easy way to Validate all before submit enabled?

    Thanks for the input and suggesstions Greg.  I'll take another stab at this.  I think I'll go with your suggesstion of only using the Submit button.  There were other reasons for having the "Review for errors" button, but I think I can work through those.
  • 05-25-2007 11:51 AM In reply to

    Re: Easy way to Validate all before submit enabled?

    Glad to help. I think your users will find it less confusing if there is just the one button.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.