473,407 Members | 2,546 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,407 software developers and data experts.

COMBO BOX - Javascript reset combo box

Hi all,

I have the following form on my page


[HTML]<form>
<select name= "combo1"onchange="jscript:document.location.hash=t his.value">
<option value="">Please Select Building</option>
<option value="build1">building 1</option>
</select>
<input type="reset">
</form>[/HTML]

What i want is to do away with the reset button, and have the box automatically reset after the jscript has jumped to the correct tag.

How can i do this?

Thanks in advance
Jan 27 '07 #1
8 19873
acoder
16,027 Expert Mod 8TB
I'm not sure what you mean by jumping to the correct tag, but you can call a function that will reset it for you, either by setting the combo value back to the original value, e.g. build1, or calling the form reset method:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(formid).reset();
Jan 27 '07 #2
how would i write that into the combo onchange, i dont know how to make the two commands run one after the other.
thanks
Feb 1 '07 #3
acoder
16,027 Expert Mod 8TB
There's two ways: either put it all in the onchange using a semi-colon (;) in between or call a function instead and put both statements in that function.
Feb 1 '07 #4
ok tried the following

[HTML]<form>
<form id="menu" name="menu">
<select name= "combo1"onchange="jscript:document.location.hash=t his.value;document.getElementById('menu').reset()" >
<option value="">Please Select Building</option>
<option value="build1">building 1</option>
</select>
<input type="reset">
</form>[/HTML]

i am so new to this javascript thing, but i cant make head nor tail of this

i appreciate your help
Feb 2 '07 #5
dmjpro
2,476 2GB
this is the best way to customize the reset button works ....not having the default behaviours of form.reset().....
<input type = button value = Reset onclick = reset()>

function reset()
{
//ur code is here...
document.getElementByName(combo_'name').selectedIn dex = 0;
}
Feb 3 '07 #6
acoder
16,027 Expert Mod 8TB
Try
[HTML]<select name="combo1" onchange="javascript:document.location.hash=this.v alue; document.getElementById('menu').reset()">[/HTML]
Note, jscript is IE-specific, use javascript instead. In fact, you don't even need "javascript:".
Also, get rid of that first form tag (the one that has no id).
Feb 3 '07 #7
Acoder thanks very much for your help and your patience.

That seems to work a treat!

Thanks again
Feb 3 '07 #8
acoder
16,027 Expert Mod 8TB
No problem. Glad you got it solved.
Feb 3 '07 #9

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

Similar topics

5
by: Harry Haller | last post by:
<select name="cboPlaces" id="cboPlaces"> <option value="3">Countryside</option> <option value="4">Forest</option> <option value="5">Mountain</option> <option value="6">Desert</option> <option...
4
by: Tim Marshall | last post by:
Does anyone have recommendations for the maximum number of records a combo box should return? I'm not talking about limits in Access itself, but rather for UI purposes, ie, what the average user...
2
by: ddog | last post by:
I have a form with 3 text fields (one of which is a zip code) and 5 combo boxes. The combo boxes are all set with the first value as 'selected' when the page is first displayed. The 3 text fields...
9
by: AMBLY | last post by:
Hello ! Could someone please help me with this? I have a ComboBox named cboSTATUS with a limited Value List, bound to Col1.. Values : "Yes";" No";" Completed" The selected Value is stored in...
3
by: Iyhamid | last post by:
Hi Every 1 I am still in big problem.. And I would like help..As u guys always do thanks to all.. My problem is that: I have A view with multible columns..Merchant ID(numbers), Merchant...
4
by: babu4all | last post by:
Sir , I am laxxmidhar swain.I want to say that , I am doing a website ,so I dont know about reset button. so,please you send a example.
0
by: sunilkds | last post by:
I want to main difference simple Combo box & DataCombo Box @ VB6.0 What is combox.listindex in DataCombo
1
by: dakshayini | last post by:
Hello, I am using one combo box filled with values.Depending on selection of value from combo box,by using observe_field,data is getting retrieved.Options for the combo box are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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
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,...
0
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...

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.