Validation and Button-click code - InfoPath Dev
in

InfoPath Dev

Validation and Button-click code

Last post 01-02-2010 10:40 AM by ricomarcelo. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 12-31-2009 12:07 PM

    Validation and Button-click code

    Hello Everybody,

    I'm new to InfoPath as a matter of fact I just started using this application this month. I use InfoPath2007 and code in C#. I have added a button on my form that adds rows to a repeating table. I also added rules to this button to validate other fields on the form for example... show messages when some required fields are blank. Now the problem is whether the validation results with error or not, the button click code still gets fired. What I want is for the button-click code not to get processed when there's any validation error. How do I prevent the click code from doing its thing when there's any validation error? Should I resort to coding the validation routine instead of using rules to validate fields? Any help would be greatly appreciated.

    Thanks,

    Rick

  • 01-02-2010 05:27 AM In reply to

    Re: Validation and Button-click code

    In the code for your button, you can check your form for errors prior to running the logic:

    if (this.Errors.Count > 0)
       
    return;

    for example....

    More info is available at MSDN....

    Hilary Stoupa

  • 01-02-2010 10:40 AM In reply to

    Re: Validation and Button-click code

    Hi Hilary,

    Thank you very much for replying. I really appreciate your help.

     

    - Rick

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.