In this article we will learn what about the error “A text field contains invalid data.Please check the value and try again.Undefined” which incurred and its solutions when I was trying to insert values to SharePoint list using JSOM from a HTML form.
Here while working on a SharePoint list to reflect data inserted from a HTML form I encountered this pop-up error displayed as below
While creating a SharePoint list we need to be careful while taking list type, and should take same type while creating a HTML form. For an example if in the SharePoint list I have taken single line of text in HTML I should also take text box, and if numbers then in HTML type should be numbers. Here this error occurs as in HTML form I had taken type s number and was trying to bind the values to SharePoint list with a column type of single line of text using JSOM, We also need to be careful while passing the HTML element’s ID in var statement in the JSOM script.
Error due to input type “number”:
<td><input type=”number” id=”LaptpID”
input type should be “text” :
<td><input type=”text” id=”LaptpID”
As in SharePoint we have taken column type as “single line of text” in HTML element type should be “text”.
Hope the above solution will be helpful.