Start New Discussion within our Web Development Community

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

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;


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"
<html lang="en">
<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">
<style type="text/css">

<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 );
// --> 
<form id="form1" name="form1" action="#" onsubmit="return false;">
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">
This article has been dead for over six months. Start a new discussion instead.