473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Drop Box error

I have attempted to implement a drop box based on Pageresource's
example

FORM name="guideform">
<SELECT name="guidelinks"
onChange="window.location=document.guideform.guide links.options[document.guideform.guidelinks.selectedIndex].value">
<OPTION SELECTED value="jdrop2.htm">--Choose--
<OPTION value="jex15.htm">Page 1
<OPTION value="jex16.htm">My Cool Page
</SELECT>
</FORM>

When I run it, however, I get 'undefined' errors in IE and Netscape -
IE displays '[directory path]\undefined', and Netscape displays message
'...unable to find the path or directory [path]/undefined'

The files specified for the OPTION values are in the same directory as
the page containg the drop box, and the file names are correct.

Can anybody give me a hint?

Thanks
Dave

Nov 9 '05 #1
8 1529
dg*****@erols.com wrote:
I have attempted to implement a drop box based on Pageresource's
example

FORM name="guideform">
<SELECT name="guidelinks"
onChange="window.location=document.guideform.guide links.options[document.guideform.guidelinks.selectedIndex].value">
<OPTION SELECTED value="jdrop2.htm">--Choose--
<OPTION value="jex15.htm">Page 1
<OPTION value="jex16.htm">My Cool Page
</SELECT>
</FORM>

When I run it, however, I get 'undefined' errors in IE and Netscape -
IE displays '[directory path]\undefined', and Netscape displays message
'...unable to find the path or directory [path]/undefined'

The files specified for the OPTION values are in the same directory as
the page containg the drop box, and the file names are correct.

Can anybody give me a hint?

Thanks
Dave


Hi Dave, this is just a simple oversight. Consider the following:

Let's just say the current URL is http://www.url.com/index.html. And
then on your page I select "My Cool Page" from your drop down box.
What would happen next? The URL becomes jex16.htm ! So to fix your
error, you would need to append the path also with the value in your
form. You can simplify your form like so:

<form name="guideform">
<select name="guidelinks"
onchange="location.href='http://www.url.com/' +
this.options[this.selectedIndex].value">
<option value="jdrop2.htm" selected>--Choose--
<option value="jex15.htm">Page 1
<option value="jex16.htm">My Cool Page
</select>
</form>

Nov 9 '05 #2
dg*****@erols.com wrote:

<SELECT name="guidelinks" onChange="window.location=...
Can anybody give me a hint?


http://www.cs.tut.fi/~jkorpela/forms/navmenu.html

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Nov 9 '05 #3
These pages are hosted on separate intranets at various different
sites, with all files in the same directory at those sites. I need to
address them relatively - is there a way I can specify
location.href=[whatever the current directory is] rather than an
explicit path?

Thanks
Dave

Nov 9 '05 #4
dg*****@erols.com wrote:
[...] is there a way I can specify location.href=[whatever
the current directory is] rather than an explicit path?


Yes, put only the resource name there.
PointedEars
Nov 10 '05 #5
Now to demonstrate my complete ignorance - what is resource name?

Thanks
Dave

Nov 11 '05 #6
dg*****@erols.com wrote:
Now to demonstrate my complete ignorance - what is resource name?


In <http://domain.example/foo/bar/baz>, which is a URI (Uniform Resource
Identifier) reference or URL (Uniform Resource Locator), "baz", as the last
segment of the resource path "/foo/bar/baz", can be called the resource
name (not to be confused with a URN, however). (The term "file name" is
generally improper for this since a resource does not need to represent
a file.)

See RFC3986 for details.
Regards,
PointedEars
Nov 11 '05 #7
Thomas,

Actually, that's what I tried initially, but am getting the "undefined"
error. I have <option value="[filename].html">Page 1,
but when I pick Page 1 in the drop box I get "...The page cannot be
displayed" with [path]\undefined (IE) or "...unable to find the file or
directory named [path]/undefined" (NS). The target file (resource) is
in the same directory as the calling page. This behavior is the same
whether I am viewing the pages as files in my development environment
or as web pages on my server.

Thanks
Dave

Nov 11 '05 #8
dg*****@erols.com wrote:
Actually, that's what I tried initially,
*What* did you try? Please quote what you are referring to,
trimming it to the parts you are directly referring to.

<http://jibbering.com/faq/faq_notes/pots1.html>
but am getting the "undefined" error. I have <option
value="[filename].html">Page 1, but when I pick Page 1 in the drop box I
get "...The page cannot be displayed" with [path]\undefined (IE) or
"...unable to find the file or directory named [path]/undefined" (NS).
You are trying to access a variable or property that was not
declared/defined or has the `undefined' value. Therefore the
resulting URI refers to a resource that does not exist (404).
The target file (resource) is in the same directory as the calling page.
This behavior is the same whether I am viewing the pages as files in my
development environment or as web pages on my server.


First, change

<SELECT name="guidelinks"
onChange="window.location=document.guideform.guide links.options[document.guideform.guidelinks.selectedIndex].value">

into

<select onchange="location = this.options[this.selectedIndex].value;">

Your referencing is proprietary (document.formName.elementName instead
of document.forms['formName'].elements['elementName']), therefore
error-prone. It is also inefficient (`this' suffices).

You don't have to explicitly set the selected property of the
first `option' element; AFAIK that is the default. You don't
even have to specify a URI for the `value' attribute of that
option if you change location only if the value does not match
a specific value.
Second, don't use `select' elements for links (they won't work
without client-side scripting), use links (in [formatted] lists,
if necessary) instead. See David's followup.
HTH

PointedEars
Nov 11 '05 #9

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

Similar topics

1
by: Sabrina | last post by:
Hi everybody, I need some help in SQL Server. I am looking for a command that will "Drop all user table" in a user database. Can anyone help me? Thank you very much Sabrina
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
6
by: Joey Liang via DotNetMonster.com | last post by:
Hi all, I have a drop down list which store all the different brands of product.When i selected the particular brand from the drop down list, it will display all the products with the selected...
1
by: Thomas Chille | last post by:
Hello! I have a Problem. A table with a ForeignKeyRef exits. The Name of the field with this FK-Constraint is 'id_employee' because it is referencing the field 'id_employee' in...
6
by: John | last post by:
I have a drop down on my form and I need all the values in that drop down and pass to a stored procedure, how can I get the values of the drop down and pass them all to my stored procedure call?
4
by: pagelogix | last post by:
I'm looking for a way to drop multple tables at the same time from my access database. Any ideas? Thanks.
5
by: sreemati | last post by:
Hi I am working on SQL SERVER 200 and I am trying to drop the default constraints set in few tables. I tired to follow the instructions given in MSDN for dropping a default: 1) Unbind the code...
0
by: yosri2005 | last post by:
Hello, I'm sure many of you have seen the error message in the subject. I found quiet a few posts on the web regarding this issue, but the ones I saw mainly tackle this issue when you have a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.