[RESOLVED] Auto Update <select> options based on other <select> options in the form
Basically I have a system that has 8 users who each have their own station. Every few months they switch stations. So I have a table to holds the user and what station they are assigned to. Now what I want to do is have a webpage that I can have a list of all of the users and a dropdown select box next to their name where I can choose the station they are assigned to. I want to make it so when a station gets selected it removes that station from the other user's options. I know I should be able to do this with a loop in javascript but I haven't used javascript too much and I'm not entirely certain how to go about doing this.
Can anybody help me with this? or at least point me in the right direction? If you have any questions just let me know!
Basically I have a system that has 8 users who each have their own station. Every few months they switch stations. So I have a table to holds the user and what station they are assigned to.
Unsure what you mean by "have their own station" and how exactly "switch stations" is determined? And "where I can choose the station they are assigned to" needs some clarification perhaps also. Are you talking about multiple users on same/different machines/and/or different logins? It sounds to me like you are looking for a server-side solution actually.
I have 8 users, and 8 computers. Every few months they switch computers, so the database needs to be updated with their new locations. Here is a basic example of what it should look like http://ais-linux.uvu.edu/onestop/tes...ait/change.php
That page doesn't do anything right now, but I want it so those dropdowns cannot ever possible have the same # selected. So if the first dropdown I choose station 2, I want the rest of the dropdowns to remove that option.
It sounds to me like you are looking for a server-side solution actually.
As I said there... javascript is not the tool you want here. Should post this in the php forum. You are going to need to require users to login to the page via password and from there it would be relatively easy to determine which users view what from referencing an administrative page. But that is not the scope of this forum.
This has nothing to do with the users needing to log in. This only has to do with the admin setting what the users are assigned to. What I want is the admin to only be able to select stations for users that are not currently in use. So the admin can't set user 1 to station 3 when user 7 is already set to station 3. So if I set user 1 to station 2, the drop down for user 2 would say "1, 3, 4, 5, 6, 7, 8" and then if I set user 2 to station 5 it would display this for user 3 "1,3,4,6,7,8" and so on. I should be able to do this with Javascript.
Here is a picture showing kind of how it should work. In the first section, all 8 dropdowns show all 8 options. In the second section the first option has #3 selected so it no longers hows up in the rest of the dropdowns. In the 3rd section you have 3 select in the first dropdown and 6 selected in the next dropdown, so both of those options are removed from the remaining dropdown menus. I want to get this to happen without reloading the page.
Bookmarks