How to get results using Javascript?

By: Jacob Vig | Asked: 10/31/2023
ForumsCategory: How-toHow to get results using Javascript?
Jacob Vig asked 9 months ago
I am trying to manipulate a results page based off of what users have entered in the form, but I don't want to have to refresh the page. I can not find ANYTHING on how to use the form results with JS. I just want to store a count of answers based on how many selections a user has selected into a variable so I can show proper results to the user, but I can not find any good way to target values using JS. Is there a good way? There is about 4 formidable uses of JS in their documentation. 
1 Answers
Rob LeVineRob LeVine answered 9 months ago
I'm pretty sure this has almost everything to do with JS and little to do with Formidable. I'll start with a few questions:
  1. What do you mean by "results page"?
  2. Can you clarify the complete user scenario, giving an example?
Jacob Vig replied 9 months ago

So the steps are this:
- User gets to page
- Completes form
- Hits submit
- Form hides and they see a "results" page.

All I want to do is, when they hit submit, fire off a little JS function that will count up how many checkboxes they checked across about 5 different questions, then manipulate the greeting on the "results" page with information based on what they submitted. I am having a hard time accessing the submitted data via JS so I can manipulate the DOM. For various reasons, I can not just set up a redirect to different results pages on form submission and was hoping to just handle this with some DOM manipulation. Unfortunately, the documentation around using formidible with JS does not have examples using JS in ways like this, and even google searches were not providing good solutions.

Rob LeVineRob LeVine replied 9 months ago

Then my suggestion is that you use jQuery/JS with ajax to call a PHP program that gets information from the entry (pass the entry key or id into the PHP program)

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right