Ok from what I understand, You want to put get data from URL into your input fields.
First, when you open the tab, put the 'document' of the tab into a global variable
var url = "www.url.com"; //the url of the page to open in tab
var tabInstance= window.open(url);
tabDocument = tabInstance.document; //tabDocument is a global variable
Now, assuming the data you want to put into the tab is in the URL of the page that is opening the tab
function populateInputFields(){
var data = parseURLParams(document.URL); //get url data in json format.
if(!data) return; //if no get parameters found
//iterate json
for(var key in data){//for each key in the json data
var value = data[key]; //get the 'value' for corresponding key
var element = tabDocument.getElementsByTagName(key)[0];//get the input element
if(element && element.tagName == 'input'){//check if element exists and is of type input
element.value = value;
}
}
}
Implementation of parseURLParams
take from here: How to read GET data from a URL using JavaScript?
function parseURLParams(url) {
var queryStart = url.indexOf("?") + 1,
queryEnd = url.indexOf("#") + 1 || url.length + 1,
query = url.slice(queryStart, queryEnd - 1),
pairs = query.replace(/\+/g, " ").split("&"),
parms = {}, i, n, v, nv;
if (query === url || query === "") {
return;
}
for (i = 0; i < pairs.length; i++) {
nv = pairs[i].split("=");
n = decodeURIComponent(nv[0]);
v = decodeURIComponent(nv[1]);
if (!parms.hasOwnProperty(n)) {
parms[n] = [];
}
parms[n].push(nv.length === 2 ? v : null);
}
return parms;
}