To find the value in an InfoPath form, we had to take a different approach than when using the DispForm.aspx page.

As usual, we loaded the .js file in the SharePoint site via a document library, and used either Firefox or Chrome to find the id of the textbox or element that stored the value we wanted to put into localStorage.

 

The code used is as follows:

window.on-load = function(){

//below line in especially important as it is required b/c of dealing with InfoPath

window.setTimeout(readyCall, 1000);

}

function readyCall(){

//below long string is what you can find via Firefox Firebug or in Chrome

var PIDString = $("#blahblahblah___yourlongstring___6a_bdfb_77ddb49aa15f_FormControl0_V1_I1_D1").val();

 

alert(PIDString);

 

Hope this helps others out there!