jdlev Posted March 12, 2013 Share Posted March 12, 2013 I've been at this for 8 hours trying to do something that is probably elementary in nature. I have a drop down list that query's my database for all unique companies, and populates the drop down list with those company's names. Each company has services associated with it that are supposed to appear when one of the companies from the drop down list is selected so you can add/edit/delete the services. So *instantly* when we select a company, I want all service records to come up for that individual company. No hitting submit or anything...just select the company and boom, the services are filled in below. Here's the rub. If they change the company name, I want it to instantly change the company, and update the services form with all of the new companies services. I've tried javascript to no avail (because I have no idea what I'm doing with js probably). So, to sum it up, I want a simple drop down list that when an item is clicked, populates the service fields below it. If the company name in the drop down is changed, the service records will also change. Thanks a ton to anybody who can help with this. I've been pulling my hair out. >:?( Quote Link to comment https://forums.phpfreaks.com/topic/275529-dynamic-forms-are-kick-my-butt/ Share on other sites More sharing options...
DaveyK Posted March 12, 2013 Share Posted March 12, 2013 I am pretty sure that this is done through JS. I would suggest an onchange event followed by an ajax call to fetch the info. You say JS didnt work, what did you try? But, unless you have SQL related issues, you may want to ask this thread to be moved! Quote Link to comment https://forums.phpfreaks.com/topic/275529-dynamic-forms-are-kick-my-butt/#findComment-1418127 Share on other sites More sharing options...
shlumph Posted March 12, 2013 Share Posted March 12, 2013 You can set an onchange event on your select element, that triggers an AJAX request which sends you the data you need to populate the other fields in the form. I would recommend a JS framework to help you with this, such as JQuery or Dojo Toolkit. Quote Link to comment https://forums.phpfreaks.com/topic/275529-dynamic-forms-are-kick-my-butt/#findComment-1418164 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.