Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select box "order these based on preference"..... 1

Status
Not open for further replies.

theEclipse

Programmer
Dec 27, 1999
1,190
US
I have a select box that I added javascript to that allows a user to re-arrange the options. The purpose of this being that the user is going to arrange the options based on personal preference.

My question is....does anybody know of an easy way to send the order of this box to the php back end?

I have thought of two possible soloutions:
[ol]
[li]On submit have javascript pull out the options and put them into a hidden field in the order they selected ... or ...[/li]
[li]On submit have javascript highlite all the options and then I will process it like a select multiple box[/li]
[/ol]

I dont really like either of them but I suppose that using the textarea would be easier than sending the select multiple.

I would also assume that there are other soloutions to the problem that I havent thought of. Anyone thinking farther outside the box than I?

Robert Carpenter
"You and I have need of the strongest spell that can be found to wake us from the evil enchantment of worldliness." - C.S. Lewis (The Weight of Glory)

 
i don't think this is possible, but why would you want to as they should be still unique?

Binary Intelligence, true or false?
 
litton1 said:
but why would you want to as they should be still unique?

I guess I am not sure that I understand what you mean.

Robert Carpenter
"You and I have need of the strongest spell that can be found to wake us from the evil enchantment of worldliness." - C.S. Lewis (The Weight of Glory)

 
Sorry for leaving it so long, it shows up on here as unchanged, also I cut and paste from the word processor and you got someone else’s reply, :( the actually answer that I posted in short is I think the hidden box is good assuming you are going to store the result in a database

Binary Intelligence, true or false?
 
I see nothing wrong with using a multiple select and select all options and then post.
However, you have to use client side scripting to move the items around. In that process it would be as easy to update a hidden field in which the options are concatenated with a defined separator character that's unlikely to be used in the options (like CSV).
 
not quite sure what all happened here but I went ahead with the hidden field that gets updated every time the order changes in the select box.

thanks

Robert Carpenter
"You and I have need of the strongest spell that can be found to wake us from the evil enchantment of worldliness." - C.S. Lewis (The Weight of Glory)

 
another option (to at least avoid client-side code):
have you considered having them select the item in the list that they want to move up or down. And submit the form based on the direction they wanted move that item.

That way you could change the order on the back end and avoid client-side script.
 
goblin-

Client side code is not really an issue because it is an internal use only page.

From the user standpoint of websites I would cringe at the requirement to reload the webpage several times just to have to order a few options. High speed internet or not that is downright annoying to me. imo there is a reason that javascript was created, and it is to solve those kind of problems. Web browsers have had javascript support for 5+ years and the only people that turn it off are smart enough to turn it back on when it is needed.

But thats just my opinion.

Robert Carpenter
"You and I have need of the strongest spell that can be found to wake us from the evil enchantment of worldliness." - C.S. Lewis (The Weight of Glory)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top