Formidable Views IF ELSE shortcode

By: Mark C | Asked: 10/26/2024
ForumsCategory: Code HelpFormidable Views IF ELSE shortcode
Mark C asked 2 days ago
Hi everyone. I'm new to Formidable Views and still learning shortcode.

I have a Formidable Form that has a hidden field. This hidden field is fetching some other user's email and its ID is 2607. 

In the Formidable Views, I have selected Grid Layout and inside a block, I want to use IF statement to show a link or not. 

Basically, the hidden field 2607 will check if it matches the current logged in user. If it matches, I want it to show a link and if not, I want to hide it. Here is the code that I have been working on:

[if 2607 equals="[email]"][editlink page_id=5966][/if 2607]

This outputs as 

"] Edit

Then I tested it as the literal email using this code:

[if 2607 equals="[email protected]"][editlink page_id=5966][/if 2607]

But this does not work. It still shows the editlink page even if the result is false. 

This is very frustrating as the syntax itself is very finnicky. Could anyone tell me what's wrong with the code? 
1 Answers
Victor Font answered 2 days ago
There's a couple of things that come to mind. The statement's syntax is correct so that leads me to believe there somethings wrong with either the hidden field or the email field. How and when are you capturing the "other user's" email address in the hidden field? Are you using AJAX or some other method. The when is important, are you capturing the email before or after the entry is created. Next, is the [email] shortcode using the actual field key for the hidden field? When you check the data in PHPMyAdmin, does the hidden field actually contain the value you seek?
Mark C replied 2 days ago

Hi Victor,

1.) I have a Formidable Form and inside, a Text Field. Its lookup is connected to a different dropdown in the form (Name). So when the user chooses a Name, the text field automatically populates it with the user's email address.

2.) The first step is when a user wants to create a request form. They will submit the data. The "level 1" users can sign this document and can update it. This means that before level 1 users can edit the form, their email is already submitted.

3.) The [email] shortcode is the current user's email.

4.) The data is only stored in form entries and not in PHPMyAdmin. Nevertheless, the hidden field contains the level 1 user's email.

Victor Font replied 2 days ago

Where are you retrieving the email address from? A drop down of user names doesn't have email addresses unless you customized something. How are you populating the email address?

How did you create the [email] shortcode? Formidable does not have a predefined shortcode named email.

All formidable entries are stored in the database and viewable through PHPMyAdmin. Please familiarize yourself with how Formidable stores entry data: https://formidableforms.com/knowledgebase/database-schema/. To say that the data is not available in PHPMyAdmin is untrue.

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