Click to See Complete Forum and Search --> : forcing selected index value for multiple selects


creativetech
04-14-2003, 12:29 PM
Hello,
I have an active server page which writes out sales leads dynamically from a database, max 10 per page. each row of leads has a select list which displays the call centre reps names, and each select list has the same name, which is "assign" - basically the user will go through the lists of leads and select a name from the dropdown lists to assign the leads to the person selected. I would like to be able to have all the dropdown lists automatically reflect the name chosen on the first one, so that he doesn't have to click on all 10 on each page, which of course is very time consuming. Is there a way to code a function which is triggered by an onChange event which will force a new selectedIndex value for all the select fields on that page, based on the one manually selected by the user?
Please note there may not be 10 leads (and hence 10 select lists) on all the pages; the last page may have less than 10, depending on how many rows are returned from the database.
I am fine with the backend code, it is the client-side Javascript I am having trouble with!

Thanks very much,

Paul

khalidali63
04-14-2003, 12:49 PM
you coud use multiple ways to get this done,
1. pass the selected index value from the first page to the next using url,an example of which is
http://68.145.35.86/skills/javascripts/DemoForwardFormDataViaURL.html

2. pass the value using form and use jsp to parse it and then update the list boxes when create them using your asp code

Cheers

Khalid

creativetech
04-14-2003, 12:57 PM
thanks for the reply!
I probably didn't clarify it well enough however...I don't actually need to pass the selected Index value from page to page, just need to change the selectedIndex for all the dropdowns on the current page, after the user selects a value from one of them - could be first one on the page, or the middle one, etc.
The <select> fields are written out dynamically using ASP, hence they all have the same name. I just wondered if there was a way to update the selectedIndex value without reloading the page or posting it back to itself, using an onChange event.

Thanks,

Paul

khalidali63
04-14-2003, 01:14 PM
Oh okkay,
I guess this will do for that

http://68.145.35.86/skills/javascripts/ListBoxDynamicallySelectAll.html

Cheers

Khalid

creativetech
04-14-2003, 01:25 PM
thanks very much! It's perfect!