PDA

View Full Version : Help with swapping/reordering unique values in a form



diablo1880
12-01-2008, 10:42 AM
Hi i've done a search here and on Google and wasn't able to turn anything up.

I am looking for a JS solution to provide the following functionality and I'm hoping I can get some help here :)

I have a list of items on a form, these items have a priority attached to them (1,2,3 etc...) which gives them a specific order within the application.

Up to now I've had to my users having to click 'up' and 'down' to modify this order but when the lists grow that is quite cumbersome.

What I need help with is a HTML form that includes Javascript that will have a series of linked drop downs (one per item) with the priority numbers in.

So if I wanted to re-order my list I'd just go to the 2nd item on the list and change the 2 to a 5, then the javascript would automatically swap those two numbers or better yet bump the original 5 and everything bigger than it down.

Though unfortunately the 'bumping down' might be tough as the priority list isn't a straight forward +1 some people's lists may go 1,2,5,7,10 for example.

I hope that was clear enough and I hope someone can point me in the right direction for the javascript :)