Programmatically designating a node as Required - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Programmatically designating a node as Required

Last post 01-17-2006 06:26 PM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-17-2006 02:10 PM

    • Mkuhn
    • Not Ranked
    • Joined on 02-02-2005
    • USA
    • Posts 2

    Programmatically designating a node as Required

    Based on a user's choice I need to set or unset a node as required "can not be blank". I want ot do this programmatically using vb.net in Visual Studio. Any ideas?

    M Kuhn
  • 01-17-2006 06:26 PM In reply to

    Re: Programmatically designating a node as Required

    Instead of using just one node that you switch validation on and off of you could use two nodes and conditional formatting.

    Say you have two nodes such as
    dataCanBeBlank
    dataCannotBeBlank

    You can use conditional formatting and a helper node to determine which node is displayed. This would be "hide control when _helperNode_ equals true".

    The only tricky part about this is using two different nodes instead of two different controls referencing the same node. Another way to do it would be to do data validation within your code, instead of embedding it within the XML schema. When a user tries to submit or save the form you can check to see if the field can or cannot be blank and if it cannot be blank, make sure that it is not. If the code discovers that there are errors you could then pop a message box and warn the user.

    I hope this helps, let us know if you have any more questions!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.