• Resolved edgepro

    (@edgepro)


    Is there a way to populate a dropdown list of choices in Ninja Forms with a field from MPG? For example, pull in a list of cites into a dropdown on a form. Perhaps that can be done with the Code Blocks form builder?

Viewing 3 replies - 1 through 3 (of 3 total)
  • MPG haven’t built-in solution for passing data to Ninja Forms, MPG just a pages generator.

    But if you have experience with php and javascript, you can try to create custom route for ajax call, get needed data on a server side using do_shortcode([mpg]...[/mpg] ), then, on page load request this route, split obtained data into DOM-nodes and replace options in Ninja Form to nodes that you create from the server data.

    But simple answer to your question – no, it’s not possible.

    Thread Starter edgepro

    (@edgepro)

    The closest thing they have is this:
    https://ninjaforms.com/blog/populate-list-field/

    But I have no idea how you could hook into that on the backend. (I know just enough php to be dangerous and I don’t think its’s practical for me to take that on!)

    Thanks for your answer though- guess I need to find one of my programmer friends that knows some php.

    Hi.

    In MPG ver. 2.8.8, which will be released soon, I’ve added a public route for ajax calls that allow you to perform requests for rendering [mpg] shortcodes.
    Example: https://joxi.ru/KAgVxYECNdJzL2

    So, you can add an “onclick” handler to some country dropdown, send a request to the server to get cities list in this country, and override options in Ninja-generated dropdown by values from your server.

    It should work, but I’m not sure if Ninja forms will correctly show values in the dashboard, which wasn’t specified when the form was built. Maybe Ninja will correctly show only predefined values.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Compatibility With Ninja Forms’ is closed to new replies.