473,791 Members | 3,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE won't see <SELECT> fields

I can't get IE 6 to read the values in my <SELECT..> data entry fields.
Netscape 7 and Opera see them, and IE will pass the values to the
database, but the javascript validation script gets a null value from
the selection fields. Text inputs work just fine.

Below is the form and validation script (I've added "...." to indicate
additional fields in the same format in both the form and the
validation)

Here's the form:
<FORM NAME="LibrarySu rvey" ACTION="FMPro" METHOD="Post" onSubmit="retur n
Validate(this)" >
<INPUT TYPE="hidden" NAME="-db" VALUE="LibraryS urvey.fp5">
<INPUT TYPE="hidden" NAME="-lay" VALUE="Master">
<INPUT TYPE="hidden" NAME="-format" VALUE="LS_ok.ht m">

<br>
<TABLE border = "0" width = "75%">
<TH COLSPAN= "3" ALIGN="center" BGCOLOR="#CC99F F"><STRONG>LIBR ARY SURVEY
</STRONG></TH>

<COLGROUP span = "3" RULES = "rows">
<COL span "1" width = 48% VALIGN = top ></COL>
<COL span "2" align = "right" width = 2% ></COL>
<COL span "3" width = 50% VALIGN = top ></COL>
</COLGROUP>
<TR>
<TD>Librarian Name </TD>
<TD></TD>
<TD>
<INPUT TYPE="hidden" NAME="Librarian Name" VALUE= "">
</TD>
</TR>
<TR>
<TD>Building </TD>
<TD></TD>
<TD>
<INPUT TYPE="hidden" NAME="SchoolNam e" VALUE="">
</TD>
</TR>
<TR>
<TD>Date of Request</TD>
<TD></TD>
<TD>
<INPUT TYPE="text" NAME="RequestDa te" VALUE="">
</TD>
</TR>
<TR>
<TD>Time of Request</TD>
<TD></TD>
<TD>
<SELECT NAME="RequestTi me">
<OPTION></OPTION>
<OPTION>7am</OPTION>
<OPTION>8am</OPTION>
<OPTION>9am</OPTION>
<OPTION>10am</OPTION>
<OPTION>11am</OPTION>
<OPTION>12pm</OPTION>
<OPTION>1pm</OPTION>
<OPTION>2pm</OPTION>
<OPTION>3pm</OPTION>
<OPTION>4pm</OPTION>
<OPTION>5pm</OPTION>
<OPTION>6pm</OPTION>
<OPTION>7pm</OPTION>
<OPTION>other </OPTION>
</SELECT>

</TD>
</TR>
<TR>
<TD>Date of Service
</TD>
<TD></TD>
<TD>
<INPUT TYPE="text" NAME="ServiceDa te" VALUE="" >
</TD>
</TR>
<TR>
<TD>Time of Service </TD>
<TD></TD>
<TD>
<SELECT NAME="ServiceTi me">
<OPTION></OPTION>
<OPTION>7am</OPTION>
<OPTION>8am</OPTION>
<OPTION>9am</OPTION>
<OPTION>10am</OPTION>
<OPTION>11am</OPTION>
<OPTION>12pm</OPTION>
<OPTION>1pm</OPTION>
<OPTION>2pm</OPTION>
<OPTION>3pm</OPTION>
<OPTION>4pm</OPTION>
<OPTION>5pm</OPTION>
<OPTION>6pm</OPTION>
<OPTION>7pm</OPTION>
<OPTION>other </OPTION>
</SELECT>

</TD>
</TR>
<TR>
<TD> Your total time on the problem </TD>
<TD></TD>
<TD>
<SELECT Name="ServiceDu ration">
<OPTION></OPTION>
<OPTION>1-5 minutes </OPTION>
<OPTION>6-15 minutes </OPTION>
<OPTION>16-30 minutes </OPTION>
<OPTION>31-60 minutes </OPTION>
<OPTION>Over 60 minutes </OPTION>
</SELECT>
</TD>
</TR>

.....

</TABLE>

</FORM>

_______________ _______________ _______________ _______________ ____
_______________ _______________ _______________ _______________ ____

And the validation function (in the header):

<SCRIPT LANGUAGE = "Javascript 1.3" type="text/javascript">
function Validate(f)
{

var mdy = new Date;
alert (f.RequestTime. value)
alert (f.RequestDate. value)
if (f.RequestDate. value=="")
{
alert("Date of Request is Required")
f.RequestDate.f ocus();return false
}
if (f.RequestTime. value=="")
{
alert("Please enter the time the request was made." )
f.RequestTime.f ocus();return false
}
.....

}
</SCRIPT>
Jul 23 '05 #1
7 2028
ta****@cornell. edu wrote:
I can't get IE 6 to read the values in my <SELECT..> data entry fields.
Netscape 7 and Opera see them, and IE will pass the values to the
database, but the javascript validation script gets a null value from
the selection fields. Text inputs work just fine.
[snip]

<SELECT NAME="RequestTi me">
<OPTION></OPTION>
<OPTION>7am</OPTION>
<OPTION>8am</OPTION>
<OPTION>9am</OPTION>
<OPTION>10am</OPTION>
<OPTION>11am</OPTION>
<OPTION>12pm</OPTION>
<OPTION>1pm</OPTION>
<OPTION>2pm</OPTION>
<OPTION>3pm</OPTION>
<OPTION>4pm</OPTION>
<OPTION>5pm</OPTION>
<OPTION>6pm</OPTION>
<OPTION>7pm</OPTION>
<OPTION>other </OPTION>
</SELECT>
The select object options don't have any values.

<OPTION>7am</OPTION> // No value

<OPTION value="7am">7am </OPTION> // This has a value


<SCRIPT LANGUAGE = "Javascript 1.3" type="text/javascript">
<SCRIPT type="text/javascript">
function Validate(f)
{

var mdy = new Date;
alert (f.RequestTime. value)
alert(f.request Date.options[f.RequestDate.o ptions.selected Index].text)

This is a cross browser and unambiguous way to reference the text(not
the value)that the user has chosen.
alert (f.RequestDate. value)
if (f.RequestDate. value=="")


if (f.RequestDate. value=="") //always false in your case, try:

if(f.RequestDat e.selectedIndex <1)

[snip]

Mick
Jul 23 '05 #2
On Mon, 24 Jan 2005 19:15:49 GMT, Mick White
<mw***********@ rochester.rr.co m> wrote:

[snip]
The select object options don't have any values.

<OPTION>7am</OPTION> // No value


That is incorrect. If a user agent follows the prose of the HTML
specification, it will use the content of the element as the initial value:

"Note that where the value attribute is set, it determines the
control's initial value, otherwise it's the element's contents."

Other browsers do this. IE doesn't.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3
Thanks Mick, Michael..

Mick's solution made the problem go away. -tc

In article <opsk4gpja5x13k vk@atlantis>, M.******@blueyo nder.co.invalid
says...
On Mon, 24 Jan 2005 19:15:49 GMT, Mick White
<mw***********@ rochester.rr.co m> wrote:

[snip]
The select object options don't have any values.

<OPTION>7am</OPTION> // No value


That is incorrect. If a user agent follows the prose of the HTML
specification, it will use the content of the element as the initial value:

"Note that where the value attribute is set, it determines the
control's initial value, otherwise it's the element's contents."

Other browsers do this. IE doesn't.

[snip]

Mike

Jul 23 '05 #4
Michael Winter wrote:

That is incorrect. If a user agent follows the prose of the HTML
specification, it will use the content of the element as the initial value:

"Note that where the value attribute is set, it determines the
control's initial value, otherwise it's the element's contents."

Other browsers do this. IE doesn't.


http://www.w3schools.com/tags/tag_option.asp

"Note: The <option> tag can be used without any attributes, but you
usually need the value attribute, which indicates what is sent to the
server."

Ambiguous, perhaps?
Mick
Jul 23 '05 #5
Mick White wrote:

http://www.w3schools.com/tags/tag_option.asp

"Note: The <option> tag can be used without any attributes,
but you usually need the value attribute, which indicates what
is sent to the server."

"Note: The <option> tag can be used without any attributes, but you
usually need the value attribute, which indicates what is sent to the
server."

Surry about the formatting.
Mick
Jul 23 '05 #6
On Mon, 24 Jan 2005 22:11:04 GMT, Mick White
<mw***********@ rochester.rr.co m> wrote:

[snip]
http://www.w3schools.com/tags/tag_option.asp
[snip]
Ambiguous, perhaps?


What does it matter? W3Schools have no authority and the specification is
clear (see
<URL:http://www.w3.org/TR/html4/interact/forms.html#adef-value-OPTION>).

However, if you're working with IE and you need to access the value
programmaticall y[1], you will always have to explicitly provide it in the
mark-up.

Mike
[1] IE does seems to conform to specification when submitting to the
server, though.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7
"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsk4pu8k4 x13kvk@atlantis ...
On Mon, 24 Jan 2005 22:11:04 GMT, Mick White
<mw***********@ rochester.rr.co m> wrote:

[snip]
http://www.w3schools.com/tags/tag_option.asp


[snip]
Ambiguous, perhaps?


What does it matter? W3Schools have no authority and the specification
is clear (see
<URL:http://www.w3.org/TR/html4/interact/forms.html#adef-value-OPTION>).

However, if you're working with IE and you need to access the value
programmaticall y[1], you will always have to explicitly provide it in
the mark-up.

Mike
[1] IE does seems to conform to specification when submitting to the
server, though.


Or if you are concerned about the weight of "doubling up" the <option>
text and value attributes, you could use a function like the following
as part of the onload event of your page:

function setOptionValues ()
{
var ii = document.forms. length;
while (ii-- > 0)
{
var f = document.forms[ii];
if (!f || !(f = f.elements))
{
continue;
}

var jj = +f.length || 0;
while (jj-- > 0)
{
var sel = f[jj];
if (!sel || !/^select/.test(sel.type) || !(sel =
sel.options))
{
continue;
}

var kk = +sel.length || 0;
while (kk-- > 0)
{
if ("" == sel[kk].value)
{
sel[kk].value = sel[kk].text;
}
}
}
}
}

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #8

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

Similar topics

2
3825
by: Andrea | last post by:
Hi, I'm trying to emulate part of our client-server application as a web site so customers can use it, and I'm stuck when it comes to re-ordering items in a list. Basically we have a list of available articles ("availableItems") and a list of articles already in an issue ("selectedItems"). What I want is to be able to move articles freely between the two lists and then on submission add them to the issue (which I can), but also move...
1
2419
by: Ang Talunin | last post by:
Hey, I wondering if it's possible to retrieve all the <option>-fields from a <select> when posting a <form> to a php file Example: I've got a form like this: <form action = phpfile.php method=post > <select name= "name">
2
1863
by: Astra | last post by:
Hi Guys Can anybody advise me on how to check for a 'no later than today's date' value from 3 <SELECT> fields. I have 3 <SELECT> fields, which are one for the day, one for the month and one for the year. All are numeric, ie the day format is 1 not 01, the month format is 11 not Nov, the year format is 2004. I have done a bit of ASP to make these <SELECT> fields auto-SELECTED to
2
17505
by: Laphan | last post by:
Hi All Could you please confirm what the syntax is to change the style of a <SELECT> box using CSS. I basically want to take the 3D effect off this box, but it doesn't seem to be possible like it is with an <INPUT> box. Thanks
6
2410
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets say I have values selected for all three pull down menus. When I change the first "top-level" menu I want to reset both the second and third menus to the "default" state.
3
1793
by: Astra | last post by:
Hi All Wondered if you could help me with the below query. I have 1 simple table called STOCKCATS that consists of 2 fields. These fields are called CATID and LEVEL. The contents of this table are as follows:
0
2234
by: rayone | last post by:
Hi folks. I need advice. 2 options, which do you think is the better option to display/retrieve/report on the data. Keep in mind reporting (Crystal), SQL Performance, VB Code, usability, architecture. Case 1: On a web page I would like to render a dropdown list
1
8854
by: ghadley_00 | last post by:
Hi, I have a php form that encodes the responses to various <Select> field drop down menus as numbers (e.g. 0 to 50), and then posts the data to a MySQL table. I am trying to implement a form to allow editing of the data already in the table. I can read the data out of the database without trouble, however I am having trouble figuring out a way to have the appropriate option in the <Select> fields chosen to reflect the data already in...
5
1718
by: Alan M Dunsmuir | last post by:
I have a Form with a <SELECTtab, its <OPTIONtabs generated by records in a database table using PHP5 and a 'SELECT' query. The values displayed are chosen to be recognisable to the users (they are in fact a list of names), but the data I need to process in the post-back come from other related fields in the same database record. I'm clearly missing something very basic here. How do I access these fields after the selection has been...
0
9666
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
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
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...
0
10201
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10147
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,...
1
7531
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
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
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.