Forcing Validation for Another Control - InfoPath Dev
in

InfoPath Dev

Forcing Validation for Another Control

Last post 12-17-2012 09:48 PM by Jim Cantwell. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-14-2012 08:38 AM

    • DevDen
    • Not Ranked
    • Joined on 12-14-2012
    • Posts 2

    Forcing Validation for Another Control

    I am using 'Validating' and 'Changed' events for all of my controls, do to the nature of some of my error messages. This means I am not using the built-in InfoPath Data Validation for each control. When the value in one control is changed, I would like it to run the 'Validating' and 'Changed' methods for that control (which it is doing properly), and then run the 'Validating' event (and possibly the 'Changed' event as it doesn't matter) for another control. Here is my scenario to better illustrate the desired outcome:

    Document Issue Date: ""
    Document Expiration Date: 12/12/12

    The Document Issue Date must be before the Document Expiration Date.

    The user changes Document Issue Date:
    Document Issue Date: 12/21/12
    Document Expiration Date: 12/12/12

    The 'Validating' method is ran for Document Issue Date, throwing an error using e.ReportError stating that the Document Issue Date must be before the Document Expiration Date.

    I would also like the 'Validating' event to be triggered for the Document Expiration Date so an error can be thrown using e.ReportError for Document Expiration Date stating that the Document Expiration Date must be after the Document Issue Date.

    Here are some other key factors:
    - These controls are part of a repeating table.
    - e.ReportError is being used to show the error, however I know I can use Errors.Add(node, name, message). The issue with this is that I can not think of a reliable way to name the error since the nodes are in a repeating table and I must call the Errors.Delete(name) before rechecking.
    - I am coding using VB.NET, though I can convert any replies from C#

    Thanks for the help and I will try to respond immediately with any questions and can post some example code. I've been working on this issue for way too long and it's time to ask some friends for help.

    DevDen

    *Edited for formatting*

  • 12-17-2012 09:48 PM In reply to

    Re: Forcing Validation for Another Control

    I think the best way to validate in this scenario is that enforce that Document Issue Date is non-blank, and that Document Expiration Date is greater than Issue Date.    That way you don't have a two-way validation situation.

    Cheers

    - Jim

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