473,804 Members | 3,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is value "undefined"

HD
Hello,

Here is my code...

<table>
<tr><td><strong >TERRITOIRES</strong></td></tr>
<tr><td><inpu t type="radio" name="terriprod " value="P"
onClick="Javasc ript:alert('la valeur de terriprod est: '
+ this.value); alert('la valeur de terriprod est: ' +
this.form.terri prod.value);">
Pays</td></tr>
</table>

The first alert shows me the value as "P" but the second alert tells me the
value is "undefined"
Can someone explain to me why this is?

Thank you.

HDumas

Jul 23 '05 #1
2 4515


HD wrote:

<tr><td><inpu t type="radio" name="terriprod " value="P"
onClick="Javasc ript:alert('la valeur de terriprod est: '
+ this.value); alert('la valeur de terriprod est: ' +
this.form.terri prod.value);"> The first alert shows me the value as "P" but the second alert tells me the
value is "undefined"
Can someone explain to me why this is?


well you haven't shown enough but it is likely that you have other
<input name="terriprod ">
elements in that form and then
this.form.terri prod
returns an array/a collection of the elements with that name

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
HD
YES!.. that's it! Thanks, now I understand.
So, if I needed to use the FORM to get to the value of terriprod...I have a
function that verifies the values of different elements of the form and
return TRUE if all information is OK...
How would I do that?

HDumas


"Martin Honnen" <ma*******@yaho o.de> a écrit dans le message de
news:41******** *************** @newsread2.arco r-online.net...


HD wrote:

<tr><td><inpu t type="radio" name="terriprod " value="P"
onClick="Javasc ript:alert('la valeur de terriprod est: ' + this.value); alert('la valeur de terriprod est: ' +
this.form.terri prod.value);">

The first alert shows me the value as "P" but the second alert tells me the value is "undefined"
Can someone explain to me why this is?


well you haven't shown enough but it is likely that you have other
<input name="terriprod ">
elements in that form and then
this.form.terri prod
returns an array/a collection of the elements with that name

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3566
by: Denis Perelyubskiy | last post by:
Hello, I have a form with an input field, a textarea, having a value of "" Also, I have some javascript code, which may be reduced to the following: function validate(mycode) { alert(mycode.value == undefined); }
13
3096
by: Don Vaillancourt | last post by:
What's going on with Javascript. At the beginning there was the "undefined" value which represented an object which really didn't exist then came the null keyword. But yesterday I stumbled across "null" string. I know that I will get an "undefined" when I try to retrieve something from the DOM which doesn't exist. I have used null myself to initialize or reset variables. But in which
25
3107
by: Nitin Bhardwaj | last post by:
Well, i'm a relatively new into C( strictly speaking : well i'm a student and have been doing & studying C programming for the last 4 years).....and also a regular reader of "comp.lang.c" I don't have a copy of ANSI C89 standard,therefore i had to post this question: What is the difference between "unspecified" behaviour & "undefined" behaviour of some C Code ??
1
3116
by: Pavils Jurjans | last post by:
Hello, I am building custom hashtable class, and thinking about value retrieval issues. The thing is, that sometimes the hashtable value may contain value null. If someone is reading this value like this value = myHashtable; then, is the value of "myKey" key is null, then the result is the same, as
49
14561
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On http://www.webreference.com/programming/javascript/gr/column9/ they say: <snip> The undefined property A relatively recent addition to JavaScript is the undefined property.
9
10753
by: Klaus Johannes Rusch | last post by:
IE7 returns "unknown" instead of "undefined" when querying the type of an unknown property of an object, for example document.write(typeof window.missingproperty); Has "unknown" been defined as a valid return value for the typeof operator in a later version of ECMAScript or is this a JScript "feature"? -- Klaus Johannes Rusch
5
6512
by: Jason | last post by:
Hello, I am trying to dynamically create a table, then set its <td>'s onclick: var table = document.createElement("table"); var row = table.insertRow(-1); var td = row.insertCell(-1); td.onclick = myfunction; function myfunction(event) { alert(event);
5
10815
by: Nathan Sokalski | last post by:
I have an ASP.NET application which is giving the following JavaScript error: 'theForm' is undefined However, when I do a View Source one of the <scriptelements is as follows: <script type="text/javascript"> <!-- var theForm = document.forms;
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10580
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9157
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.