While using InfoPath Form for a SharePoint 2010 List > I encountered the following error.
InfoPath cannot submit the form because it contains errors.
Cannot be blank.
I tried with the following approaches & Failed:
- Manually created the field from InfoPath & Assigned Validation Rule. Failed as Validation rule was not enabled for the field
- Removed mandatory check box for the field. Worked but customer requires the field to be mandatory. Failed.
Following are the 2 lists included:
- Contracts list with Customer Name field & Product Code field pointing to Products list
- Products list with Code field
- The following approach worked:
- Removed the field from SharePoint
- Created the field from InfoPath
- Used Choice field with multiple values
- Used Data Connections to Populate field value
- Published & Tested
- It worked
Following are the steps to implement the Solution.
Step 1: Delete existing field
Delete the field from SharePoint. Save Changes.
Delete the field-row from InfoPath Form. Save Changes.
Step 2: Add Field from InfoPath
Create the field from InfoPath.
Choose Actions > Add Field
Choose Data type > Choice (allow multiple selections)
Choose Mandatory option
Click OK button to save changes.
Step 3: Add Field to Form
Right click and add a row to InfoPath form.
Drag & Drop the new field Product Code from the fields list to the form.
Step 4: Add Data Connection
Now the new field & control is missing data-population.
To add a data connection > right click the product code input-area & choose Properties menu.
In the appearing Properties box > Choose Get choices from external data sources option.
Click on the Add button to create the data source.
Choose the options as shown below.
Choose your SharePoint site as shown below.
Choose the Lookup List. (the secondary list from where data is pulled)
Choose the fields to display. (In our case only Code field exists)
Enter the name for the data connection. (You may use the Suffix as DS)
Click the Finish button to save changes.
Step 5: Save & Publish
Click the Save button & Publish the form
Step 6: Test the form
Test the form by adding a new item. You should see the item insertion succeeded without any errors.
You can try with multiple-value checking & getting displayed in the view mode too.
This concludes our solution to Lookup field error in InfoPath forms. I hope you enjoyed the solutionv