1,105,416 Community Members

assign the value to a hidden field

Member Avatar
Newbie Poster
10 posts since May 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]

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
Member Avatar
Newbie Poster
15 posts since Feb 2009
Reputation Points: 22 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]

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.

Member Avatar
Newbie Poster
3 posts since Aug 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]

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

Member Avatar
Posting Shark
974 posts since Aug 2008
Reputation Points: 84 [?]
Q&As Helped to Solve: 138 [?]
Skill Endorsements: 0 [?]


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 three months: Start a new discussion instead
Start New Discussion
Tags Related to this Article