Checking form validation before submit button rules - InfoPath Dev
in

InfoPath Dev

Checking form validation before submit button rules

Last post 01-27-2016 05:37 AM by profskett. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 09-16-2014 11:47 AM

    Checking form validation before submit button rules

    Hello everyone,

    I have a submit button with a single rule.  In this rule I have several actions that occur before the "submit using a data connection" action.
    The problem I am encountering is that my form validation is not occurring until after those other actions occur.  In other words, my form validation isn't being checked until the "submit using a data connection" action.  I need the form validation to happen before any of these actions occur.  None of the actions should occur if this form isn't at least valid.

    Does anyone have any suggestions on how to accomplish this?

  • 09-16-2014 12:39 PM In reply to

    Re: Checking form validation before submit button rules

    qRules has a command that can get you an error count, or code can be used for this....

    I think for a no-code solution, I'd try to submit the form first, then run the other rules, then submit again. So - if the first submit attempt fails because of the form being invalid, that should stop the rest of the rules (I think - may want to test that to be sure). If it succeeds, as long as your rules aren't going to set anything to an invalid value, the second submit after the rules run should also succeed....

    Hilary Stoupa

  • 09-16-2014 01:21 PM In reply to

    Re: Checking form validation before submit button rules

    Sorry I think perhaps I am unclear.  I can't try to submit first because then if there isn't any error it will submit before the other actions in the rule execute.  I need them to run before the submit, but I need the validation to run first.

    So the submit should be to check the form is valid first, perform these additional actions, then submit the form.
    If the form is not valid to submit, no other actions should occur.

  • 09-16-2014 02:13 PM In reply to

    Re: Checking form validation before submit button rules

    You were clear - I was trying to offer a work around with a dual submit - the first one to check and see if the form is valid, the second one to submit the "real" data after your rules run. So there would be two submit rules in the set of rules. Do you have SharePoint workflow running on the library that submitting twice would cause an issue?

    Hilary Stoupa

  • 09-17-2014 06:16 AM In reply to

    Re: Checking form validation before submit button rules

     Yes, unless there's someway to "fake" the first submit?

  • 09-25-2014 01:22 PM In reply to

    Re: Checking form validation before submit button rules

     Still looking for some help :/

  • 09-25-2014 02:37 PM In reply to

    Re: Checking form validation before submit button rules

    Again, submitting twice would the only way I can think to do this without code. Maybe promote another field and set the value to "1" on the first submit (or something) and use that to prevent your workflow from running?

    Hilary Stoupa

  • 01-27-2016 05:37 AM In reply to

    Re: Checking form validation before submit button rules

    I am currently looking at doing the same in a form I'm working on, and I don't fancy going down the 'dual submit' route either, as I imagine that this would make the submit button quite slow. The only other method I can think of (without code) would be to test all your validation conditions using an action rule associated with your Submit button, and then prevent any further rules from being performed if the validations are not satisfied. I think this should be fine in my case, given I don't have too many validations to test, but I can see that it is not a very elegant solution (I guess it makes the validation rules essentially redundant).

    Stephen Skett
    Radiotherapy Physicist
    Cheltenham General Hospital
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.