How to find whether a field is a required field - InfoPath Dev
in

InfoPath Dev

How to find whether a field is a required field

Last post 10-25-2007 11:58 PM by anujQA. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-23-2007 12:12 AM

    • anujQA
    • Not Ranked
    • Joined on 08-01-2007
    • Posts 9

    How to find whether a field is a required field

    Hi,

    I need to find out whether a field is a required field (cannot be blank) or not through code.

    Any ideas on how can I find that a particular field is a reqired field or not.

    Also, if enter an invalid entry e.g. a character in date field, the filed gets outlined in red to point out that it is an invalid entry.

    How can I determine through code whether an invalid entry has been made or not.

    Please let me know if you have any suggestions.

    Thanks in advance.

    Anuj Chaudhary

  • 10-23-2007 01:14 PM In reply to

    Re: How to find whether a field is a required field

    The easiest way to do this would be to search through the errors collection and see if that node is listed. Of course this only works if the field is not yet filled out.

    Similarly you can determine that way if there is an existing error in a node. If you want to verify validation upon entry the onValidate event should do the trick.

    Thanks, Shiraz

    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 10-24-2007 02:06 AM In reply to

    • anujQA
    • Not Ranked
    • Joined on 08-01-2007
    • Posts 9

    Re: How to find whether a field is a required field

    Thanks Shirz but this approach is not working for me. Actually, I am trying to open an existing form through my code.

    I want to know whether a field in this form is required or not.

    When I try to use the property Xdocument.Errors, it throws an exception System.InvalidCastException.

    Is there a different way of knowing which fields are required ones.

    Hope you can help me finding a solution for this problem.

    Anuj Chaudhary

  • 10-25-2007 11:58 PM In reply to

    • anujQA
    • Not Ranked
    • Joined on 08-01-2007
    • Posts 9

    Re: How to find whether a field is a required field

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