0

I have SharePoint 2010 list and I Customize list form in InfoPath form in 2010

In my scenario I have 15 Fields

I want to give the validation alert on fields before submitting the button.

Also one more thing at the end of the form whenever m going to submit the data following error occurs,

I want user friendly message over here. as "Please fill all the required fields"

Please Help

Thanks in advance

3 Answers 3

2

In InfoPath :

1.Select the field for validation.

2.If the Rules task pane is not already showing, click Manage Rules on the Home tab.

3.In the Rules task pane, click New then select Validation to create a validation rule action.

4.Build a custom rule to validate the field

For details use this link (look at Part 3 ─ "Adding Validation, Conditional Formatting, and Logic to Your Form").

1
  • In Infopath form 2010, I could not able to add more than 5 fields in the validation rule. In my scenario i need to add 7 fields in the validation rule when submitting the button. There is restriction in the infopath form 2010 that we could not able to add more than 5 fields in rule.
    – user876869
    Nov 21, 2013 at 9:41
1

Create a calculated field, let's say it's called NonBlankFields. Set the formula of this field to be all of the string lengths for the fields you want to check multiplied together. If any of the fields have a 0 length, the product will be zero. You can have a formatting rule with the condition that if NonBlankFields = 0 then disable your SUBMIT button.

Example:

string-length(Name) * string-length(phone) * string-length(email)

If any of those fields are blank, the result = 0 otherwise it is some meaningless number.

1
  • I was struck with similar issue for longest time and your solution helped me to fix it . Great thanks :)
    – user9167
    Dec 22, 2016 at 8:49
1

I use Phil Greer's elegant solution, but eliminate the computed field. Instead, I insert his formula directly into the Condition of the Formatting Rule:

InfoPath Formatting Rule, Condition dialog box.

My expression, which validates six fields, looks like this:

string-length(/my:myFields/my:scnBasicProgramInformation/my:ContactPerson/pc:Person/pc:DisplayName) * string-length(/my:myFields/my:scnBasicProgramInformation/my:ProgramTitle) * string-length(/my:myFields/my:scnBasicProgramInformation/my:ProgramBegin) * string-length(/my:myFields/my:scnBasicProgramInformation/my:ProgramEnd) * string-length(/my:myFields/my:scnBasicProgramInformation/my:ProgramLocation) * string-length(/my:myFields/my:scnAudience/my:Audience) = 0

I obtain each field's XPath location by finding the field in the "Fields" window, right-clicking on it, and selecting "Copy XPath":

InfoPath "Fields" panel pop-up menu with "Copy XPath" highlighted.

That stores the field's XPath location it in the clipboard. I paste each XPath location into NotePad, where I assemble the entire expression before copying and pasting it into the Condition dialog box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.