Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 10th, 2005, 11:41 AM
Authorized User
 
Join Date: Nov 2005
Location: , , United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default submit form on listbox onchange

simple question i think, but i have a single form with a drop down list, i want the form to submit on change of the list box, i have tryed having
onchange="javascript:this.submit()" and calling this function

<script type="text/javascript">
 function DoSubmit(form) { form.submit(); }
</script>

but still nothing, any ideas? cheers

Reply With Quote
  #2 (permalink)  
Old December 10th, 2005, 12:02 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Try:
Code:
onchange="this.form.submit();"
--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old December 10th, 2005, 12:14 PM
Authorized User
 
Join Date: Nov 2005
Location: , , United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

perfect, thanks! new it was a simple one

Reply With Quote
  #4 (permalink)  
Old December 10th, 2005, 08:31 PM
Authorized User
 
Join Date: Nov 2005
Location: , , United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

have another one, i have the same list box

problem i have found now, it submibts on onchange, when the page first loads, the first item thats in it, is selected, so if say you wanted to submit on that first item, you have to select somethin else, and then go back and select the first item again

so i need the first item to be like '- Select Item -', but this gives another problem, you can select the '- Select Item -' item, and it then submits using this, which is ..well bad, so is there a way to have it so onchange it calls a javascript function that 1. removes the first element ( the '- Select Item -' entry ) and second, submits the form - but this cant just remove the first entry, as it submits to a frame below, so if you were to submit more than once, it would remove the next element and so on, deleteing data
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting onChange Event w/Dynamically Created Form rvanandel Javascript How-To 4 June 28th, 2007 08:10 AM
Listbox Selected values to be displayed on Submit dom1975 C# 0 September 17th, 2005 04:29 AM
access listbox in onchange event ozcyberus1 JSP Basics 0 September 6th, 2004 05:34 PM
Onchange listbox Varg_88 JSP Basics 1 June 16th, 2004 07:45 AM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM



All times are GMT -4. The time now is 11:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.