Jump to content

Recommended Posts

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. >:?(

Link to comment
https://forums.phpfreaks.com/topic/275529-dynamic-forms-are-kick-my-butt/
Share on other sites

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!

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.