"Rules and Custom Code" Button breaks Field Validation - InfoPath Dev
in

InfoPath Dev

"Rules and Custom Code" Button breaks Field Validation

Last post 11-27-2008 05:23 AM by Shiva. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 11-21-2008 04:25 AM

    • zartr
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 15

    "Rules and Custom Code" Button breaks Field Validation

    I'm submitting my forms data to a webservice. I'm doing that in my code behind file. This is necessary because there's quite some code to be executed prior to submitting the data to my webservice. For example my "submit" webservice takes parameters that are only available in code behind.

    The problem I am facing is, that as soon as you don't use a standard "submit" button the field validations are completely ignored. For example I can have "cannot be blank" fields which in fact can be blank. Is there a way to trigger Field Validation in code behind?

  • 11-21-2008 04:38 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: "Rules and Custom Code" Button breaks Field Validation

    Hello,

    We can you the below code to find the errors in your form. Errors include validation errors and data type validation errors.

    if(XDocuments.Errors.Count > 0)

    {

    XDocument.UI.Alert("Validation message");

    return;

    }

  • 11-21-2008 04:57 AM In reply to

    • zartr
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 15

    Re: "Rules and Custom Code" Button breaks Field Validation

     XDocument?

    Also note I am using browser enabled forms (browser only that is).

  • 11-21-2008 05:30 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: "Rules and Custom Code" Button breaks Field Validation

    Hello,

    Sorry that is XDocument itself. We have to use XDocument in the place of XDocuments in above code.

  • 11-25-2008 01:51 AM In reply to

    • zartr
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 15

    Re: "Rules and Custom Code" Button breaks Field Validation

    XmlForm.Errors (= type FormErrorCollection)
    I guess XDocument is old school Infopath 2003. Thanks for the hint anyway.

  • 11-27-2008 05:23 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: "Rules and Custom Code" Button breaks Field Validation

    Hello,

    Glad you found the answer. Looking forward to your participation in our forum and to helping you with your InfoPath projects. Whichever I gave syntax from InfoPath 2003.

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