473,503 Members | 1,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using getElementByid and getting dataset count and not value

4 New Member
I am trying to validate that a null value is not chosen from a dynamic dataset called "OBDataSet__135_1" when a form Submit operation is performed. To do this I have a javascript function called "verify()" that attempts to validate the value in the select list dataset called "OBDataSet_135_1". The select list dataset is not static. The following statement --- document.getElementById('OBDataSet__135_1').length ; -- that fires within the verify() function returns the length of 267, which is the count of the values in my select list. The use of --document.getElementById('OBDataSet__135_1').value; -- returns null even when I choose a value. What I suspect is happening, is that I need to choose an element of my select list with some like this --document.getElementById('OBDataSet__135_1[i]').value; --, but this is not working. How should I be doing this to get the value?

Expand|Select|Wrap|Line Numbers
  1. --- form level function call
  2. <form method="POST" name="form1" onSubmit="return verify();">
  3.  
  4. -- test statement wthin verify() function.
  5. alert("get length" + document.getElementById('OBDataSet__135_1').value);
  6.  
  7. --dynamic select list
  8. <select size="1" name="OBDataSet__135_1" id="OBDataSet__135_1" onChange="this.form.input1.value=this.options[this.selectedIndex].value">
  9.                                                                </select></td>
  10.  
Oct 30 '06 #1
2 3800
vssp
268 Contributor
Sorry what u want I am not clear

vssp
Oct 30 '06 #2
iam_clint
1,208 Recognized Expert Top Contributor
Heres a clear example i made you. enjoy :).
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function verify() {
  3. var obj1 = document.getElementById('OBDataSet__135_1');
  4. alert(obj1.options[obj1.options.selectedIndex].text)
  5. }
  6. </script>
  7. <input type="button" value="Test" onclick="verify();">
  8. <select id="OBDataSet__135_1">
  9. <option>a</option>
  10. <option>b</option>
  11. <option>c</option>
  12. <option>d</option>
  13. </select>
  14.  
Oct 30 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

15
3190
by: lawrence | last post by:
Sorry for the dumb question but I'm new to Javascript. I wrote this script hoping to animate some div blocks on a page. You can see the page here: http://www.keymedia.biz/demo.htm Can anyone...
2
23874
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
4
22408
by: Deepankar | last post by:
Hi, I was trying to change an example for SQL Server to work with Access db to insert image data. I have everything working except getting the OleDbParameter type for the image column. The...
0
6414
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
1
6391
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
1
2616
by: keith.walter | last post by:
My first asp.net app is almost "done" and I am stuck. Here is my situation: I have a "mother" page add_customer.aspx and a"child" user control add_group.ascx. On the mother page is an "add...
3
3968
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
3
4301
by: nuchphasu | last post by:
Hi I have a problem on Dropdownlist that connect database and retrieve data by Ajax.I write javascript like this -------------------------------------------------------------------------...
7
2010
by: JDOMPer | last post by:
Don’t misunderstand me – I use AJAX, but I think there is a far simpler, elegant alternative that just uses Javascript, the DOM and Php ( hence - JDOMP) for data transfers, and is cross-browser...
0
7203
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,...
0
7089
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5581
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,...
1
5017
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...
0
4678
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...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.