have a javascript
in which i am trying to assign the value to a hidden field and getting the below msg

'document.Form1.H_ROWID' is null or not an object

i am getting the value in the alert box but not able to assign it o teh control

alert("row " +M_ROWID)
document.Form1.H_ROWID.value = M_ROWID

Recommended Answers

All 3 Replies

You'll need to post the HTML that goes along with this. My guess is that your form is not named, or the form has a miss-spelled input field.

You should actually be setting the hidden field like this: document.getElementById('H_ROWID').value=M_ROWID;

Hi,

under IE mode you must include a name="someName" attribute along with your input elements'. Here's a quick demontration:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>http://www.daniweb.com</title>
<style type="text/css">
<!--

-->
</style>
<script type="text/javascript">
<!--
window.onload = function() {
var form;
   if ( document.all ) { form = form1; }
   else { form = document.getElementById("form1"); }
   form.H_ROWID.value = form.M_ROWID.value;
   alert( "row " + form.H_ROWID.value );
};
// --> 
</script>
</head>
<body>
<div>
<form id="form1" name="form1" action="#" onsubmit="return false;">
<div>
Test field: <input type="hidden" id="H_ROWID" name="H_ROWID" value="">
Test field<input type="text" id="M_ROWID" name="M_ROWID" value="Default Value">
</div>
</form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.