473,395 Members | 1,688 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,395 software developers and data experts.

select box - using refresh to select same item twice

I was experimenting with trying to select the same item in a select box
twice in a row
and found out that you need to do a refresh (view - refresh) in
Internet Explorer. This is
so you can click on the same item twice "in a row" to select it.

Does anyone know how to automatically make a web page do a refresh when
the web
page loads? This would prevent the user from having to do the refresh,
themselves.

An example select box would be

<select name="colors" onChange="form1.submit();">
<option value="red">red</option><option
value="blue">blue</option><option value="green">green</option><option
value="purple">purple</option>
</select>

A typical scenario:

1. The user clicks on blue
2. form1 is submitted
3. The user presses the browser back button
4. The user clicks on red
5. form1 is submitted
6. The user presses the browser back button
7. The user clicks on red
8. nothing happens, since onChange did not detect a "change".

In other words, how do you click on red twice?

Any workarounds on how to do a refresh or something to get around this
above scenario
are highly appreciated!

--- Entfred

Jul 25 '06 #1
2 2798
entf...@hotmail.com wrote:
Does anyone know how to automatically make a web page do a refresh when
the web
page loads? This would prevent the user from having to do the refresh,
themselves.

An example select box would be

<select name="colors" onChange="form1.submit();">
<option value="red">red</option><option
value="blue">blue</option><option value="green">green</option><option
value="purple">purple</option>
</select>

A typical scenario:

1. The user clicks on blue
2. form1 is submitted
3. The user presses the browser back button
4. The user clicks on red
5. form1 is submitted
6. The user presses the browser back button
7. The user clicks on red
8. nothing happens, since onChange did not detect a "change".

In other words, how do you click on red twice?
As a matter of consideration to limited access users (keyboard only)
it's not advised to submit forms when a select element is cycled. They
will always be forced to submit on the second selection. Rather, it is
better to accompany a submit button with the select. That would solve
your problem, as well.

Jul 25 '06 #2
en*****@hotmail.com wrote:
I was experimenting with trying to select the same item in a select box
twice in a row
and found out that you need to do a refresh (view - refresh) in
Internet Explorer. This is
so you can click on the same item twice "in a row" to select it.
That approach has serious usability issues as described by bobzimuta.
It is generally a bad idea to use onchange with a select for anything,
or to use onchange on any form control to submit a form.

However, to address the other parts of your question...

Does anyone know how to automatically make a web page do a refresh when
the web
page loads? This would prevent the user from having to do the refresh,
themselves.
You can use window.onload to reset the form.

An example select box would be

<select name="colors" onChange="form1.submit();">
Using the form name this way is not a good idea. If the select is a
control of form1, use:

<select ... onchange="this.form.submit();">

Otherwise use:

<select ... onchange="document.forms['form1'].submit();">
The way you have used it 'works', but it is easy to break.

<option value="red">red</option><option
value="blue">blue</option><option value="green">green</option><option
value="purple">purple</option>
</select>

A typical scenario:

1. The user clicks on blue
Given that red is the first option (and probably the default selected),
selecting it won't fire the onchange handler. Given your scenario, the
first option must be blank or other invalid selection to force the user
to change it and fire the onchange handler. As a result, you can't
have a useful default selection, users *must* change the selection. If
you allow the user to select an option, then submit the form, they can
choose any value and you can set a useful default.
2. form1 is submitted
If they are using keyboard navigation, IE will submit the form as soon
as they navigate up or down using a cursor key. onchange is supposed
to fire when the control loses focus, IE does it prematurely in this
case.

[...]
--- Entfred
The correct way to add a signature is to have two dashes, a space and a
return on a line by themselves. That allows news readers to
automatically trim the signature when quoting.
--
Rob.

Jul 25 '06 #3

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

Similar topics

9
by: Mr Newbie | last post by:
Before someone flames me, I know this is the VB.NET groups, nonetheless, the asp.net guys seems to have almost disapeared from the aspnet groups so I thought I would ask this here. I have a...
4
by: Jeff | last post by:
Hey gang. I have a form to select multiple names. The problem I am having, is when it gets to the asp page. If I click 1 name, it will process. But multiple names gives me an error: Either BOF or...
1
by: Areric | last post by:
Hey all, Does anyone know how i can detect a refresh of the page in the unload event on the server? The problem I'm having is that refresh automatically calls the previous event that happened...
6
by: yc022 | last post by:
Hi all, this is my first time using this so i'm not really sure how it works. please bear with me. i am trying to delete a row in a database using a select list. First of all i have a query to...
4
by: =?Utf-8?B?SmFtZXMgR2V1cnRz?= | last post by:
On my page, I have one repeater that contains a literal control and a nested repeater. The nested repeater contains a literal control. Both repeaters are databound with only one object (string). ...
4
by: [Jongware] | last post by:
I have a large table in XML, of the form (simplified) <item><a>data1</a><b>more 1</b></item> <item><a>data1</a><b>more 2</b></item> <item><a>data2</a><b>more 3</b></item> -- where I want the...
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
4
by: Patrick Nolan | last post by:
I am using javascript to manipulate optgroups in select elements. When the results are displayed in Firefox 2.0 there is an annoying blank line at the top of the multi-line select box. This...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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
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...

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.