none
InfoPath error when submitting to SharePoint list "One or more fields have invalid values and cannot be submitted to the list"

    Question

  • I am using an InfoPath 2010 form to submit data to a SharePoint 2010 list.  One of the drop-down fields in my form is connected to an external list in the same site collection as the SharePoint list.  Using a rule, I also populate two other fields in the form from the same row I select from the external list in my drop-down.  The drop-down and the two other fields seem to work fine; I select a value from the drop-down in the first field, then the other two fields automatically populate correctly.  There are no required fields in my form so I can submit the form with just the three fields if I want.  However, whenever I submit I get the error I mentioned.  Looking in the SP logs I get this: "Data adapter failure during submit: The form cannot be submitted. One or more fields have invalid values and cannot be submitted to the list. Invalid choice value.  A choice field contains invalid data. Please check the value and try again."  The drop-down field is obviously my choice field but I can't understand why it doesn't like any of the values.

    Thoughts?

    Tuesday, December 17, 2013 7:07 PM

Answers

  • As an alternative, try using a simple text field, and just change the control to a drop-down. Then you can have the Value and the Display name point to the text value and no validation will kick in unless you specifically define it.

    cheers, teylyn

    • Marked as answer by Hibbarc Wednesday, December 18, 2013 1:38 PM
    Tuesday, December 17, 2013 8:38 PM

All replies

  • Hello,

    what are you saving in the drop-down field values? For a lookup to another list, the Value should be the ID and the Display name should be the text field, like the title. If you store the text field as the Value, you may run into issues.



    cheers, teylyn

    Tuesday, December 17, 2013 7:58 PM
  • Here's a screenshot of what I'm saving:

    The value is the ID (from the BDC) and the Display is the text field I want to appear in the drop-down.

    Tuesday, December 17, 2013 8:06 PM
  • Hmm, I looked at the ID and it's a total of 408 characters.  Will that break anything?
    Tuesday, December 17, 2013 8:27 PM
  • I see that your data type is the Choice, not a lookup field. There may be an issue with this.

    Try defining the SharePoint column as a lookup type instead of a choice field.

    Also, the Value does not seem to be the SharePoint ID, but a field called BdcIdentity. Try using the ID field instead.


    cheers, teylyn


    Tuesday, December 17, 2013 8:35 PM
  • As an alternative, try using a simple text field, and just change the control to a drop-down. Then you can have the Value and the Display name point to the text value and no validation will kick in unless you specifically define it.

    cheers, teylyn

    • Marked as answer by Hibbarc Wednesday, December 18, 2013 1:38 PM
    Tuesday, December 17, 2013 8:38 PM
  • I think I found the problem.  The data from the drop-down is originally coming from an Oracle database.  Since InfoPath isn't very friendly with Oracle DBs, I linked the Oracle server to our SQL server and created a table in a SQL database using a stored procedure.  I run the stored procedure once a day to refresh the data from Oracle to SQL.  I created an External Content Type from the SQL table using SP Designer and then created an external list in SP using the ECT.  The external list in SP only has four fields, and the BDC Identity is probably being used as the ID field (there is no ID field in this external list and the BDC Identity field didn't come from the Oracle DB or me). 

    I liked your idea of changing the control to a drop-down so I tried that and this time, in the browser form, it's telling me the 255 character limit has been exceeded.  The value from the drop-down isn't over the limit, but the ID (BDC Identity) is 408 so I'm betting that's where the breakdown is. 

    I'm going to look for ways to create a more friendly ID (and I'm a bit curious why SP didn't create an ID field in the first place).  Let me know if what I'm saying makes sense or if you don't agree.

    I'm going to mark your response suggesting the simple text field and changing the control as the answer because it certainly helped me uncover an error that I could better understand and identify the issue.

    Thank you very much for your expertise!


    • Edited by Hibbarc Wednesday, December 18, 2013 1:40 PM
    Tuesday, December 17, 2013 9:11 PM
  • Just to be thorough, I'll share how this issue was resolved.  The SQL table I was using for my ECT did not have an identity column.  I altered the table with the command: ALTER TABLE MyTable ADD ID int IDENTITY(1,1) not null.  I then updated my ECT in SP Designer with the new ID column.  From there, the rules I was using in InfoPath to automatically populate the other two fields from the drop-down field were updated so they were no longer using the BDC Identity but rather the ID field.  Everything works now.

    Thanks again!

    Wednesday, December 18, 2013 2:27 PM