Combo Form Field Help

I am creating an admin backend for a site.
This admin backend will add instructors.
I need to have the ability to assign the instructors to several categories. So far easY? Multiple select field.

Here is where i am stuck.
I need a nice way of adding new categories on the fly without refreshing entire page.
Anyone know of any ajax, jqueryui or tutorial on how to accomplish this using PHP/MYSQL values that populate the categories field?


So you’re looking at this from the Admin user’s POV.

The user is looking at an Instructor Edit page.

You have a multiple select field (box).

You need to add a new item to the select field box. So you need a separate form/lone input box with a button next to it that says “Add Category”.
Add Category button is wired to javascript that kicks off an AJAX request to the server.
Server takes in Category Name, spits out Category ID and Name again.
AJAX handler processes return, appends element to the list.

So… ignoring the fact that this requires your user to have javascript enabled, what part of the three are you having difficulty with?

1: Forming the AJAX request
2: The PHP to receive the AJAX request and return the reponse
3: The line of jQuery needed to add the category to the box

Show us what you’ve done, and we can try and point you in the right direction.

Hi Starlion.
Thanks for your response.
Im having an issue with all 3.
I am not good with AJAX, so I was looking to see if anyone knew of a solution that exists with documentation on how to install.

Basic AJAX example:
Basic AJAX tutorial:
(This covers #1; #2 you should be able to do)
jQuery to append a category to a multi-select: $(“#catSelect”).append(‘<option value=“1”>My option</option>’);