Interact with page html through php

[ad_1]

Idk if this is possible or what the best method is to go about doing this. I am using the FluentForms plugin and am trying to create buttons with custom content on the buttons as in they will be populated by data from an API response. The FluentForms plugin doesn’t really allow this, so instead I am using the plugin to create a blank div with a class, and trying to inject the button html into that div. When the user clicks the button, I will also need to update some other parts of the html as well as run more code within the php function.

Am I overthinking this? I told my client it might be better at this point to ditch the plugin and let me make the form from scratch, but the preferred for me to try and figure out a workaround.

[ad_2]
2 Comments
  1. For more context, I am currently running the function through my own separate plugin, using an action_hook available through the FluentForm plugin that runs between form steps. I am able to successfully make API calls using form data to an API I created, but am now trying to use the data I get back to populate the buttons. Those buttons can then be selected to automatically fill/change certain form fields/selections.

    It’s all starting to feel a bit messy and I’m wondering if I just got too far into it by trying to make it fit with the form plugin rather than creating my own plugin or form from scratch.

  2. You need to use AJAX to bridge the gap. Once the data is populated, in the on success do whatever DOM manipulations you need. When someone clicks the button, use JS to execute further AJAX calls.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer