I apologize if this is pretty standard and I’m just not seeing the hooks or way to do it. But I’d like to be able to conditionally show and hide stuff on the same page as a form - while the form is being filled out. Similar to the Product Configurator that the JetSloth guys demo’d but not necessarily just image selections.
I’ve been trying to find a way to access the array of data with each selection. And this needs to be during the form fill out, so accessing pre submission isn’t going to work.
Any ideas or points in the right direction would be awesome. Thanks!
Hi Kane. Can you give a more complete explanation of what you need to accomplish? Normally, the conditional logic setting is used to show or hide fields in the form based on selections the user has made. Here’s an explanation of how that works:
I suspect there is more to your requirements that was not clear to me here, so I’d like to hear more about what you need to accomplish exactly, to see if there is a built in method in Gravity Forms to do that. Thank you.
Hi Chris - Thanks for the response and I’m sorry I was vague. Each time a new selection is made, I’d like to be able to access wherever the selection data is being stored (that will be processed during submission) so that I can control images that are displayed on the page outside of the form. So a drop down value is selected and then I can look at the selected value and make a decision to do something on the page (with JS I would imagine).
JetSloth’s product configuration demo is solid and might be all I need as a base to work with. But I wanted to see first if there were any other listeners I can leverage or hooks to grab, etc.
The data is only available with JavaScript or jQuery at that point, live on the page. There’s nothing specific in Gravity Forms that allows you to access that. The Gravity Forms conditional logic is written in jQuery, so it actually watches for changes or selections, and then ‘does something’, to reveal or hide a field. I suppose that you could use conditional logic in Gravity Forms to show/hide “something” (even if that something is an empty HTML field, hidden with CSS or something), and then use this JavaScript hook to ‘do something’ in the page, outside the form:
Got it! “Live on the page” is what I’m looking for I think. Or this hook. When you say live on the page, is there a variable or something I can watch? Sorry for the continual follow up questions, but I think that will be my last because we’ve narrowed in on it. I just can’t seem to find where GF is accessing the data - is it literally looking at the fields stored or is the data continually added to a variable kinda like Google’s DataLayer? Thanks again!
Hi Kane. It’s all handled in the browser. It’s accessible via jQuery or JavaScript. It’s not stored by Gravity Forms anywhere until the form is submitted. This hook can do things after the conditional logic is processed, which is what I think you need to do?