Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Dynamic lists or form fields

I want to create a form with a dropdown list of locations, a required field.

We already have a database that contains a list of store locations and their associated brands that is updated as we get new locations or brands change.
It would be great if we could fill that location field with a query from this database. I have the php/mysql knowledge to make the query, but have no idea how to implement it into the list or field.

What is the best way to accomplish this?

Tagged:

Comments

  • I recently had to do something like this for a mod I wrote and have been using for years [Agencies Dropdown and Admin UI for osTicket 1.7ST (source) ]. The basic flow is:

    1. create the list (in ost admin panel, or manually, or script it) the list name is stored in ost_list. note the id.

    2. connect to your second DB query and get your locations.

    3. make 1 entry per location in ost_list_items to the list you made in 1. This will populate the list.  This will not add location information to already existing tickets.

    4. Go into osTicket and go to admin panel -> manage -> forms. Choose which built in form you want the data associated with. (so far most of my custom forms have gone in "Ticket Details"). Enter a label (Location), in type pick the list you made in step 1 (locations). Check the Required box. in Variable type "location".

    4A (optional). drag your new form field up above "Issue Summary".  This will make the drop down box appear when opening the ticket before the title subject field.

    5. hit save changes at the bottom of the page.

    This will make the [required locations] drop down appear in the ticket details section of your ticket and people will pick a location when they open new tickets.
  • Going to give this a try, thank you!
  • You are very welcome. :)  Glad to help.
  • please could you help me,
     i'm trying to add a dropdown list filed to the ticket form ,that gets the data from database
    I want it to be a dynamic field like the priority  dynamic field
    i searched for the code corresponding to  priority  dynamic field but i didn't found it.
    the code is complex to follow
    any help please
  • @Marwa start your own thread.

    Killing this zombie post with a head shot.
This discussion has been closed.