Writing the External Web Page


The following code creates an HTML page to show the query parameters in a table, as well as two submit buttons. The submit button redirects the Web page back to the Swift MEAPâ„¢ application based on the query parameters 'Id' (which stores the uid value) and 'PresRowId' (which stores the devicerowid value) that were passed to the Web page from the Swift MEAPâ„¢ application.

After the Swift MEAPâ„¢ application synchronizes with the data source, the Submit button which uses the devicerowid will no longer be able to find the record, because the ID of the record is overwritten with the ID generated by the data source and stored in the uid field of the record.



The inbound URL to launch Swift MEAP is:

"XXXXX://ModuleLaunch?ModuleId=2&Id="+d; 


The complete code example with header and footer information is as follows:

<html><head><style>
html{overflow-y:scroll;} body{
	font-size:12px; color:#000000;
	background-color:#F6F4F0; margin:0px;
	width: 960px;
}
p,td,ul{
	line-height:140%;
}
body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input{ 
	font-family:verdana,helvetica,arial,sans-serif;
}
iframe {margin:0px;} div {width:100%;} img {border:0;}
table,th,td,input,textarea{ 
	font-size:100%;
}
table {
	margin-left: 30px;
}
table.reference,table.tecspec{ 
	border-collapse:collapse;width:100%;
}
table.reference tr:nth-child(odd) {
	background-color:#F6F4F0;
} 
table.reference tr:nth-child(even) {
	background-color:#ffffff;
} 
table.reference tr.fixzebra {
	background-color:#F6F4F0;
} 
table.reference th{
	color:#ffffff;background-color:#555555;border:1px solid #555555;font- size:12px;padding:3px;vertical-align:top;text-align:left;
}
table.reference th a:link,table.reference th a:visited{ 
	color:#ffffff;
}
table.reference th a:hover,table.reference th a:active{ 
	color:#EE872A;
}
table.reference td{
	border:1px solid #d4d4d4;padding:5px;padding-top:7px;padding-bottom:7px;vertical- align:top;
}
table.reference td.example_code{
	vertical-align:bottom;
}
</style>
<script type="text/javascript"> 
onload=function(){
	var nrCols=2; 
	var maxRows=4;
	var nrRows=maxRows+1;
	var root=document.getElementById('myid'); 
	var tab=document.createElement('table'); 
	tab.className="reference";
	var tbo=document.createElement('tbody'); 
	var row, cell;
	var inputButton;
	var inputButton1; 
	row=document.createElement('th');
	row.appendChild(document.createTextNode("Query Param")); 
	tbo.appendChild(row);
	row=document.createElement('th'); 
	row.appendChild(document.createTextNode("Query Value")); 
	tbo.appendChild(row);
	var a=document.URL; 
	var b=a.split("?");
	var c=b[1].split("&"); 
	d = null;
	for(var i=0;i<c.length;i++){ 
		if(c[i].split("=")[0]=='PresRowId'){ 
			inputButton1=document.createElement("BUTTON");
			inputButton1.appendChild(document.createTextNode("DeviceRowId")); 
			d = (c[i].split("="))[1]; inputButton1.addEventListener('mouseup', function() {
				window.location = "XXXXXX://ModuleLaunch?ModuleId=2&Id="+d;
			});
			continue;
		}
		if(c[i].split("=")[0]=='Id'){ 
			inputButton=document.createElement("BUTTON"); 
			inputButton.appendChild(document.createTextNode("Uid")); 
			d = (c[i].split("="))[1]; 
			inputButton.addEventListener('mouseup', function() {
				window.location = "XXXXXXXX://ModuleLaunch?ModuleId=2&Id="+d;
			});
			continue;
		}
		row=document.createElement('tr'); 
		for(var j=0;j<nrCols;j++){ 
			cell=document.createElement('td');
			cell.appendChild(document.createTextNode(c[i].split("=")[j])) row.appendChild(cell);
		}
		tbo.appendChild(row);
	}
	tab.appendChild(tbo); root.appendChild(tab); root.appendChild(inputButton); root.appendChild(inputButton1);
}
</script></head><body><div id="myid"></div></body></html>