Reputation: 2220
I have the following form in one of my asp.net :
<html>
<head>
<script type="text/javascript">
function GetSampleModel() {
try {
var wldscan = new ActiveXObject("WebLogonDemoClient.WLDScan");
var Sl_No = wldscan.GetSl();
var sampleModel = wldscan.GetVerifyTemplate();
if (sampleModel.length == 0) {
alert("Something is Error!!!", "Error");
}
else {
document.getElementById("scan").Sl.Value = Sl_No;
document.getElementById("scan").SampleModel.Value = sampleModel;
document.getElementById("scan").submit();
}
}
catch (err) {
alert("To verify with a fingerprint device, you should install the WebLogonDemoClient software first.", "Software Not Install Error");
}
}
</script>
<title>Logon</title>
</head>
<body onload="GetSampleModel()">
<form name="scan" id="scan" method="Post" action="" runat="server">
<input type="Hidden" name="SampleModel" value="">
<input type="Hidden" name="Sl" value="">
</form>
</body>
</html>
The action of this form is as following :
http://localhost/finger/famverifyTX.aspx?name=18&appuser='RANA001'&ailogid='1'&depamount=50&sessid='28902343093145'&custno='18'
After form submission, I am trying to get submitted data in another page by the following code :
sl = Request.Form["Sl"];
String SampleModel = Request.Form["SampleModel"];
But there is no data in these 2 variables. Where am I doing mistake ? Please help me .
NameValueCollection nvclc = Request.Form;
After debuggin I am seeing the value of variable as following :
{__VIEWSTATE=%2fwEPDwUKLTE4MDU5MzAwNg9kFgICAw8WAh4GYWN0aW9uBUNmYW12ZXJpZnlUWC5hc3B4P25hbWU9JmFwcHVzZXI9JmFpbG9naWQ9JmRlcGFtb3VudD0mc2Vzc2lkPSZjdXN0bm89ZGRLaLIbf6gMRB5SeuUkSj7FHaf%2fRZQuSXp1AE1b4qHvCw%3d%3d&SampleModel=&Sl=&__VIEWSTATEGENERATOR=9EF55AFD}
I have this code :
string[] keys = Request.Form.AllKeys;
var value = "";
for (int i = 0; i < keys.Length; i++)
{
// here you get the name eg test[0].quantity
// keys[i];
// to get the value you use
value = Request.Form[keys[i]];
Response.Write("Keys is " + keys[i] + " and value is " + value+"<br>");
}
This code shows this output :
Keys is SampleModel and value is
Keys is Sl and value is
So the value of SampleModel and Sl is nothing . How can I get this value from fmaVerifyTX.aspx page ? Please help me .
Upvotes: 2
Views: 144
Reputation: 2220
The following code works for me :
document.getElementById("Sl").setAttribute('value', Sl_No);
document.getElementById("SampleModel").setAttribute('value', sampleModel);
Upvotes: 3