Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 10th, 2005, 11:41 AM
Authorized User
Join Date: Nov 2005
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(); }

but still nothing, any ideas? cheers

Old December 10th, 2005, 12:02 PM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts


Joe (Microsoft MVP - XML)
Old December 10th, 2005, 12:14 PM
Authorized User
Join Date: Nov 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

perfect, thanks! new it was a simple one

Old December 10th, 2005, 08:31 PM
Authorized User
Join Date: Nov 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

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

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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.