[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

trying to get the text of a select box in reusable function

  • To: "Xml-Dev (E-mail)" <xml-dev@l...>
  • Subject: trying to get the text of a select box in reusable function
  • From: "Rochester, Dean" <Dean.Rochester@P...>
  • Date: Fri, 1 Mar 2002 11:45:53 -0500

select box text
Hi

I am trying to write a reusable function that I can use to get the text of a
select object.  I do not know the name of the select, I am walking through a
form.

Here is what I have tried.  It does not like the use of the 

toString(elements[intLoop].getAttribute('name'))

in the last line.


strField = elements[intLoop].getAttribute('value');  
// if the field is a select box the value from the line above will
// be null even if there is a value in the box.
// you need the option selected value for the strField variable
if (strField == null || strField == "") {
     var OptionsList =
document.forms[0].toString(elements[intLoop].getAttribute('name'));
     strField =
document.forms[0].toString(document.forms[0].getAttribute('name')).options[O
ptionsList.selectedIndex].text;
}

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.