This topic is locked
[SOLVED]

Dialog API - Populate dropdown with data

5/17/2021 2:59:08 AM
PHPRunner General questions
A
AlphaBase author

What event or method or techinque would one use to call a Dialog AP with a dropdown on the dialog populated with data from a table?

https://xlinesoft.com/phprunner/docs/about_dialog_api.htm

A
AlphaBase author 5/17/2021

Just to clarify a little further. Where would the select statement go where I would then pass the result set into the dropdown?

Admin 5/20/2021

In the article you referencing see Note 3, it explains how to retrieve data from the database and pass it to Dialog API.

A
AlphaBase author 5/22/2021

Thanks for pointing out Note 3. It had already occurred to me to use the button 3-part event(s). Haven't had a chance to try it out yet. Hopefully this weekend.

A
AlphaBase author 5/22/2021

So here is my dilema. I can use a button, read the select records back to the server, do some processing and then return the data in the Client After event to display the dialog. The user selects a record from a dropdown (which was populated with some data from the server event). Now when the user clicks "OK" I need to run a server event to update the selected data.

How do I run a "second" server side event from the dialog api's okay button?

To recap:

  1. User selects some records and clicks a custom button
  2. Client before event grabs the selected keys
  3. Server event runs a SQL SELECT to get some other data to display in a Dialog API dropdown
  4. Client After event displays the Dialog API which displays the dropdown
  5. User makes a selection from said dropdown
  6. User clicks "OK" - which we want to use to run a SQL UPDATE on the selected data

1 through 5 is straightforward enough. How do I do #6? That is the question.

HJB 5/23/2021

Custom dependent dropdown boxes

... for inspiration purposes only ...

A
AlphaBase author 5/23/2021

Thanks HJB. This looks interesting but it's a lot too digest. Not sure I'll be able to implement it.

W
wpl 5/23/2021

Alphabase,

I think what admin is pointing to is: if your button is sitting on a list page, you could populate an array with the needed information from a table in "BeforeShowList" event
of this page and then pass this array as a proxy object to JavaScript. Then, in "ClientBefore" of your custom button, you would poulate the dropdown list with the array
passed as a proxy object. The id of the selected item of the dropdown will then be automatically sent to the server event of the button where you could update your records,
accordingly.

Regards

A
AlphaBase author 5/24/2021

Thanks WPL. Actually, I did think of that. It's a possibility, but not an ideal solution. I may use that as a lsast resort. Another possibility is using JS to click a custom button - not sure if you can click a hidden button?

Admin 5/26/2021

Just something that will help you implement bullets #3 and #4:
Database-based dropdowns with Dialog API

A
AlphaBase author 5/26/2021

Just saw that. That's great. Can't wait to try it out.

Thanks much!