User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,882 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,290 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1802 | Replies: 2 | Solved
Reply
Join Date: Mar 2008
Posts: 5
Reputation: jeffasbrand is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jeffasbrand jeffasbrand is offline Offline
Newbie Poster

Select all the items in a listbox right before submit.

  #1  
Mar 12th, 2008
I have a need to force all items in a listbox to become selected before I force a submit.

I need something to select everything in a listbox called SpacesServed:

$("#form1").submit( function() { . . . code goes here . . . } );

Any ideas?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Location: georgia
Posts: 55
Reputation: hunkychop is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
hunkychop's Avatar
hunkychop hunkychop is offline Offline
Junior Poster in Training

Re: Select all the items in a listbox right before submit.

  #2  
Mar 12th, 2008
is this what you are looking for?
<script type="javascript" >
//replace formname with with the name of your form and inputname with the 
//name of the input field you want to select
document.formname.inputname.focus(); 
  document.formname.inputname.select(); 
</script>
toast
Reply With Quote  
Join Date: Mar 2008
Posts: 5
Reputation: jeffasbrand is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jeffasbrand jeffasbrand is offline Offline
Newbie Poster

Re: Select all the items in a listbox right before submit.

  #3  
Mar 13th, 2008
Actually, no.

The code I ended up needing/using was more like this:


$("#Formname").submit( function() {
$('#listbox2').attr('selected','true');
});

Thanks though.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 10:33 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC