Conditionally show a form or a view based on parameter in URL

By: Jan Siwinski | Asked: 02/06/2024
ForumsCategory: General questionsConditionally show a form or a view based on parameter in URL
Jan Siwinski asked 3 months ago
I'm really rusty with Formidable forms at the moment. It's been a while.

I seem to remember being able to show a form on a page based on a parameter in the Url, but find no documentation to support that on the FF site or community site. Have I dreamed this feature? I know I could conditionally hide/show anything in a view but I'm trying to save that headache for later in my project. For now I want to register a user who has 4 registration options. Since I can't make form actions conditionally create subsites or not etc.. I'm going to have to achieve it by having an initial form which when submitted redirects to the correct, more detailed registration form that can eventually use form actions to register the user accordingly.. I'd rater do that without having to have all those other forms on a new page of their own, rather, on submition of the first form, show the applicable second form on the same page in its place
1 Answers
Rob LeVineRob LeVine answered 3 months ago
Showing a form on a page is done using a formidable shortcode, e.g., [formidable id="1"], so if you want to conditionally show a form, you'll have to use something outside of Formidable so that it skips that shortcode completely (you can use jQuery or some plugin that allows you to hide/show Wordpress content). As for views, it's not hard to hide/show content. There are various ways to do it, one of them being the use of frm-condition as seen here and another is using conditional statements as seen here.
Jan Siwinski replied 3 months ago

Thanks for your reply, Rob.

I try to stay away from other plugins where possible. Before you know it you've a plugin for every task needed and a bogged down site. Back when I knew what I was doing I found I could use FF for most tasks I needed.

Frm-condition may be a good option. I'll have a good read up.

I was thinking after submitting this post. I could display a view for Form A in the forms submit confirmation message, conditionally showing the applicable registration form.

I also found this JS option but I'm pretty sure it just changes the CSS classes to hide/show the correct form. Which I'm guessing means it unnecessarily loads all four forms

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