How to setting values of InfoPath Textbox with jquery/javascript, json.
Put this code in CEWP on a web part page containing an InfoPath Form Web Part.
Set delay, as InfoPath loads asynchronously, so document ready in jquery does not work.
window.onload = function()
{
window.setTimeout(readyCall, 1000);
}
then get reference
var textBoxEmployeeId = $("#ctl00_m_g_9053a19d_7ea2_49c3_9af1_11ab9e5bbca3_FormControl0_V1_I1_T2");
then call json endpoint
var url = "https://yourserver/endpoint?callback=?";
$.getJSON(url, null, function (data) {
textBoxEmployeeId.val(data["EmployeeNumber"]);
});
then set focus. This is VERY import in InfoPath, or else it will not presist or preserve the data
textBoxEmployeeId.focus();
In InfoPath set the postback options of the field to NEVER
This way you can call json, or other web services, and write the values to InfoPath