I am trying to display a set of records and each
record contains 2 or 3 fields along with a submit button and whenever the user clicks the button i would like to track the contents of the respective record and pass it as the paramter to the next jsp.

Brian Glodde

You could use JavaScript to build a querystring:

<html>
<head>
<script language="JavaScript">
function buildParams( str )
{
    var param1 = eval( "document." + str + ".text01.value" );
    var param2 = eval( "document." + str + ".text02.value" );
    var url    = 'nextpage.jsp?param1=' + escape(param1) + 
                 '&param2=' + escape( param2 );
    location.href = url;
}
</script>
</head>
<body>
<form name="frm01">
<input type="text" name="text01" value="value 1 text">
<input type="text" name="text02" value="value 2 text">
<input type="button" name="btn01" value="Submit" onclick="buildParams('frm01');">
</form>
</body>
</html>
You may want to cause a POST rather than a GET. In that case you would set all the form parameters (action,method) via JavaScript, then .submit() the specific form.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact