I use a JScript function that executes on the clicking of the submit button. It gets the value of each element id within the form named WebBrowser1.
- Code: Select all
<html>
<head>
<title>Webpage Form</title>
<script>
function getFORMvalues()
{
var x=document.getElementById("WebBrowser1");
for (var i=0;i<x.length;i++)
window.alert(x.elements[i].value);
nbSetVar ( 'formarray[i]', x.elements[i].value );
}
</script>
</head>
<body style="color: blue; font-family: Arial;">
<center><form id="WebBrowser1" name="WebBrowser1" method="post" action="javascript:getFORMvalues()"><table width="100%" border="0">
<tr><td width="50%"><div align="right" id="WFFlabel">Name</div></td><td width="50%"><div align="left" id="WFFDataCol"><input type="text" name="text1"
id="text1" size="" /></div></td></tr>
<tr><td width="50%"><div align="right" id="WFFlabel">address</div></td><td width="50%"><div align="left" id="WFFDataCol"><input type="text"
name="text2" id="text2" size="" /></div></td></tr>
<tr><td width="50%"><div align="right" id="WFFlabel">city</div></td><td width="50%"><div align="left" id="WFFDataCol"><input type="text" name="text3" id="text3" size="" /></div></td></tr>
<tr><td width="50%"><div align="right" id="WFFlabel">phone</div></td><td width="50%"><div align="left" id="WFFDataCol"><input type="text" name="text4" id="text4" size="" /></div></td></tr>
</table><p><input type="submit" id="Submit" value="Submit" />
</form>
</center>
</body>
</html>
The NB variable does not get set. I inserted an alert box to see if I was generating the value properly and I am (the values entered into the form are shown in the alert box for each loop) but the nbSetVar command does not create/populate the NB variable in the NB app.
I have used window.external.nbSetVar and just nbSetVar. I have put the script in the header and in the body. These things are not the issue but I must have some syntax wrong.
If anyone has an insight as to my error, I'd appreciate hearing it.
David P.