Validation rule to be activated only on click on submit. - InfoPath Dev
in

InfoPath Dev

Validation rule to be activated only on click on submit.

Last post 10-18-2015 11:03 PM by Himanshu_Saxena. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 09-25-2015 03:20 AM

    Validation rule to be activated only on click on submit.

    I have a form created with many fields which are mandatory. I want a validation to be done on the sheet for all fields before it has been submitted. Also looking for a customize error message which says which are the fields which are left blank Can someone help me on this?
  • 09-27-2015 10:40 PM In reply to

    Re: Validation rule to be activated only on click on submit.

    So by mandatory do you mean cannot be blank? And if there is a blank have any attempt to submit fail and something advise the user which field they left blank? Does that sum the problem up?
  • 09-27-2015 10:55 PM In reply to

    Re: Validation rule to be activated only on click on submit.

    Yes.. All fields are mandatory.. once users click on submit they should get an pop stating which fields are left blank
  • 09-27-2015 11:46 PM In reply to

    Re: Validation rule to be activated only on click on submit.

    Any field with a red asterisk is supposed to signal the user that that field is mandatory, you probably knew this but just making sure, user education may be the quickest way to solve this.

    Assuming you already know this here is what I would do. Hilary, the all wise and powerful, will probably have a better way but this is my stab at it.

    For every field that is mandatory create another text box. So if the field ColorOfEyes and the field Gender are mandatory create two more textbox fields, say call it ColorEyeBlankCheck and GenderBlankCheck.

    For each mandatory field set a rule, condition will be If ColorOfEyes is blank, set a fields value, this field will be the ColorEyeBlankcheck, and the value you set will be the text "Color Of Eyes Field cannot be blank". Do the same for the Gender field.

    Create another textbox called SummaryOfBlankFields. The value of this field will be all the XBlankCheck field values concatonated together. If one of the mandatory fields has text in it nothing will be in the blankcheck value so you won't see it in the Summary field, but if the mandatory field is blank then the text will display.

    Create a section, put the SummaryofBlankfields text box in there. Have text in the section that says Fields you have left blank: then place the Summary text box after it. Have a rule on the submit button that hides the section unless any of the mandatory fields are blank. This will be your "popup".

    Option two:

    Create a new view, the view educates the user by telling them some mandatory fields have been left blank and it has not been submitted, and to return to the form and look for the red asterisks. This view would be a rule on the submit button, the conditon would be if any of the mandatory fields are blank then switch views to this view. Have a return to the form button on the new view so the user newly educated can go back and fix their error then click submit again.

  • 09-28-2015 05:49 AM In reply to

    Re: Validation rule to be activated only on click on submit.

    I Like option two, but what would be the condition rule? How would I set that rule? 

  • 10-11-2015 11:51 PM In reply to

    Re: Validation rule to be activated only on click on submit.

     Would be a rule on the submit button. The rule would be if Color of Eyes is blank OR Gender is blank (repeat as many times as you have mandatory fields) then change view to the "education" view (for lack of a better word). Just make sure you have a button on the education view that returns them back to the first view. The user will still have to click through the form generated warning that it couldn't be submitted, just fyi.

  • 10-18-2015 11:03 PM In reply to

    Re: Validation rule to be activated only on click on submit.

    There are couple of ways for this. I have created a sample and attaching it. I have 3 fields 1. Name 2. Age and 3. Email. On submit button I am checking each filed, if it is blank or not. The pop-up will not work in browser based form so I have created new fields with each filed say NameCheck, AgeCheck and EmailCheck to show the error message. The Error Check fields are hidden. Now when you will click on the Submit first it'll check the name and if it is blank it'll show an error message saying Name can't be blank and so on. The validation rules are in a sequence and I have submit in the end ie. after all the validations. We can show the error message in the same field but it won't be true when I'll click second time. (Try to understand this part and this is the reason why I have added an extra field.). Once a rule is true the control will not go to next. Once all the rules are false ie. all the fields having a value the control will go to the Submit option and before submitting, we need to clean all the error message. (This part is necessary or else you'll be having the error messages, even after submitting.) Please save the form locally and modify the submit data connection. Please let me know if you have any question.
    Himanshu Saxena
    MSFT
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.