aeroswat Posted February 16, 2010 Share Posted February 16, 2010 Here is my predicament. I have a list box on the left side of my form that holds a list of system names and on the right side are some control boxes that should pertain to information associated with each system. I am trying to get help on how I should go about solving the following problem: Whenever you click the system on the left side I want it to update the control boxes on the right side to display the information associated with the selected school system. Furthermore I want this to be a form that I can edit so I can make any changes that I need to and then hit the submit button to change the information for that system. I understand that this will require Javascript and PHP most likely. Any ideas on how I could set this up? Quote Link to comment Share on other sites More sharing options...
aeroswat Posted February 16, 2010 Author Share Posted February 16, 2010 Bump to the top Quote Link to comment Share on other sites More sharing options...
aeroswat Posted February 16, 2010 Author Share Posted February 16, 2010 Sorry. It's also not technically a list box. It's a select html tag that has a predefined size. So therefore it is not a drop down. Quote Link to comment Share on other sites More sharing options...
Axeia Posted February 16, 2010 Share Posted February 16, 2010 You would need to set an onchange listener on <select> and then manipulate the other values when that change event is triggered. Do you plan to just load in a couple of predefined 'settings' on the 'right side' or do you intend to alter the entire structure of the form? Say on the left you have <select> <option>Cars</options> <option>Bikes</option> </select> and the right would be (semi pseudo code).. <label>Color:</label> <select> <option>Red</option> <option>Green</option> </select> Do you want to do something like add a third color 'Yellow' when Cars is selected or do you want to do something like add a checkbox "Spare tire". The latter could be quite a bit of work on PHP side with a lot of if( isset($_POST['whatever']) ) checks and would probably be easier if you simply had separate forms (if possible) instead of one big magic do-it-all form. Quote Link to comment Share on other sites More sharing options...
aeroswat Posted February 16, 2010 Author Share Posted February 16, 2010 They are pre-defined controls. I think this might have to be the way I do it although it seems rather sloppy to me. I have a list of school systems on the side. Each school system is assigned a Region #, Account #, and name. When you click the school system in the box I want to be able to show the region/acct/name on the side and have that part editable. So if they have a certain school selected and they change the name and click submit then I want it to update the database (the easy part). What I'm going to have to do until I get a better solution is the following: Populate the list box Trigger a javascript function in the onchange event That function will use the ajax function to call a php file That php file will send back a comma delimited list for what should be filled in the boxes The javascript will break apart that list and fill in each appropriate control with the value from the delimited list. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.