move selection to next box

M

middletree

We have all seen those web pages which feature a multiple <select> box on
the left, and an empty one on the right, and the user selects one or several
options from the left box, clicks a button, and those selections appear in
the right box.

Although I have seen these, I have never tried coding them before, until
now. I imagine that there is some client-side code involved, but because my
code will use ASP to do some stuff with the selections, I figured it was OK
to ask it here. Can someone direct me to some sample code for this?

I have searched on some ASP code sites, but haven't found anything, probably
because I don't know a short description for this kind of thing.
 
B

Bullschmidt

I'd suggest using JavaScript to submit the page (assuming the page is
being posted back to itself anyway) and then if the page is a post, show
the extra info in the second listbox. You can see an example of this on
the sample database on the Web on my site -
www.bullschmidt.com/login.asp and then go to the Invoices dialog and
choose a rep in the listbox and notice that the page is posted to
itself, the customers listbox then gets the focus, and the customers
listbox only contains the customers for that rep.

And here's a function I've used to submit the page for this purpose:

function RefreshPg(pstrFldName) {
// Purpose: Refresh pg. to update other fld(s) based on selection.
// Remarks: Used by combo's onchange.
// Assumes existence of document.frmMain.FocusedFldName hidden fld.

// Set focused fld for when come back.
document.frmMain.FocusedFldName.value = pstrFldName;

// Msg.
alert("Refreshing page to update other field(s) based on your
selection.");

// Submit pg to itself to refresh other combo based on this combo.
document.frmMain.submit();
}

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top