JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 14th, 2006, 09:38 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 14
A drop down form without a submit button

I would like to know the javascript code that you use to enable a selection to be made on a drop-down menu without having to click on an extra submit button. Dev Articles Forum uses exactly this when inviting users to jump to the required forum from the main page.
I know it's something based around the normal html form of:-
<form name="form1" method and action etc>
<select name="choice">
<option selected value='1'>1</option>
<option value='2'>2</option>
</select>
</form>
and I think 'onchange' is used somewhere. However, I don't don't really know how or where. Could someone help.
Cheers

Reply With Quote
  #2  
Old June 14th, 2006, 11:14 AM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 552 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 33 sec
Reputation Power: 14
forum jump

The forum jump (used in this forum) is using
onchange this.form.submit
in the select
EDIT:
The onchange is in the select, not the options. Sorry for any confusion.

Last edited by Mittineague : June 21st, 2006 at 08:41 PM. Reason: clarification of misinformation

Reply With Quote
  #3  
Old June 14th, 2006, 11:50 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 14
Hi Mittineague! do have to declare the js function in the head?

Reply With Quote
  #4  
Old June 14th, 2006, 12:30 PM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 14
Well I don't know whether I have used your code wrongly but it did not work. However, I found this nice code and this works! Without any declaration the head.

<form id="Form1">
<select onchange="document.getElementById('Form1').submit()">
<option>Choose...</option>
<option>Red</option>
<option>Blue</option>
</select>
<noscript>
<input type="submit" value="Go" id="Submit1" />
</noscript>
</form>

Thanks all the same though.

Reply With Quote
  #5  
Old June 14th, 2006, 11:13 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 13
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
Exclamation

SnapCracker...

the coding you displayed above DOES NOT work if you want to add a [onSubmit] in the form tag, of course depending on what Mittineague wanted, if he wanted to check the value of the select, in which case currently no value is included, it will not submit, i tried. Please post back.

colton22 -- http://www.freewebs.com/colton22

Reply With Quote
  #6  
Old June 15th, 2006, 03:49 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 14
Yes colton22, as much as it pains me to admit it, it won't work if there is a value declared, it will take the as the option and usually you will want a value different to the option. BTW I took a 'peek' into your website and was all excited to see how you achieved this in your 'select a song' menu, however in IE ver 5.2 for Mac it does not work but looks great in black and red. I tried in Safari, Macs own browser, and the menu works and shows a 'play' button, but on a white background and looks totally different.
Cheers

Reply With Quote
  #7  
Old June 15th, 2006, 08:04 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
Wow, someone who tests with IE/mac... ;-)

Does the following code give some insight in how to make something like this?
I'd also prefer to avoid the NOSCRIPT tag in favour of DOM... but I guess it doesn't hurt.
Code:
<html>
<head>
<script>
function submitMyForm(sel) {
	alert(sel.options[sel.selectedIndex].value);
//	sel.form.submit();
}
</script>
</head>

<body>

<form id="Form1">
	<select onchange="submitMyForm(this)">
		<option>Choose...</option>
		<option>Red</option>
		<option>Blue</option>
	</select>
	<noscript>
		<input type="submit" value="Go" id="Submit1" />
	</noscript>
</form>

</body>
</html>
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #8  
Old June 15th, 2006, 08:51 AM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 14
Wink

Thanks MadCowDzz (you neither any 3 of these) that's what makes you internet famous! Now we are firing on all cylinders here. It's just perfect and I spotted the nice little touch to be able to toggle between submitting and alerting just by sliding the comments-out up over the unwanted action!
Yes I aways test out in IE for Mac by default because I don't use a PC although it'll sadly be the same one day. And while we are on that subject, in IE v5.2 I can't see what's around the code tags on this forum unless I click on the quick reply link on the right and it shows it in the edit box. Is that normal for your mac mini? (how do I know, you're internet famous!)

Reply With Quote
  #9  
Old June 15th, 2006, 12:30 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
heh, I actually ordered a MacBook today... I've been eyeballing it for a few weeks now, but i'll credit this thread as giving me that final push (thanks!)... Don't rely on testing in IE/mac and assuming it will display that way in windows... I can almost guarantee it won't... Don't forget to test on Windows still.

That's an interesting bug... I'll have a go when I'm at home on the mini to see if I experience the same thing. I rarely have IE set as my default browser, on mac I prefer Safari and Firefox.

Reply With Quote
  #10  
Old June 15th, 2006, 04:20 PM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 14
I don't rely on IEv5.2 at all, I was horrified the first time I looked at my own web pages on a friends PC! I have altered the whole site as a result. PC IE seems to stretch the page vertically and so doesn't fit so much in. I have javascript drop-down menus unrelated to this post ( 3000 lines of code) which you have helped out with before, which don't work at all in FireFox (PC or Mac), so that's another job for me to do. However, I don't how to approach it cos Safari and Firefox both share the same gecko like structure. But I'm sure it's possible in JS.
Cheers MCD.

Reply With Quote
  #11  
Old July 7th, 2006, 03:30 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 13
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
yea the reason my website looks bad in all browsers except IE/WIN was in my style i had this...

<STYLE TYPE="text/css">@import:url(colton22_main.css);</STYLE>

in which only imports in that one browser, thanks for letting me know though,

sence then i installed, FF, NN, Opera, and the new IE 11 Beta 3

colton22

ps: did you get your problem fixed?? (the one that was originally posted?)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > A drop down form without a submit button


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap