We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,534 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

assign the value to a hidden field

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
4
Contributors
3
Replies
5 Months
Discussion Span
3 Years Ago
Last Updated
4
Views
surekhavk
Newbie Poster
10 posts since May 2008
Reputation Points: 10
Solved Threads: 0
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.

scrager
Newbie Poster
15 posts since Feb 2009
Reputation Points: 32
Solved Threads: 2
Skill Endorsements: 0

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

Krondorl
Newbie Poster
3 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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>
essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.2951 seconds using 2.7MB