Hello, I'm using the wpv-conditional shortcode in two different ways at the top of a page to show text if a toolset field is empty, or show alternative text if it is not empty.
Later on the same page I have a toolset form with a field that is initially null. The user can enter text and submit, after which the field value should not be null.
However, the wpv-conditional text that is shown is always reflecting that the field of interest is empty, even when it is not.
Note that I have a separate wpv-conditional shortcode inside the User Form code below, but this works as expected and is not part of the issue.
Thanks for any help!
SHORTCODES USED IN POST
[wpv-conditional if="( empty($(wpcf-1-1-hard-labor-symptom)) )"]
This field is empty or does not exist[/wpv-conditional]
[wpv-conditional if="( NOT(empty($(wpcf-1-1-hard-labor-symptom))) )"]This field is not empty[/wpv-conditional]
[wpv-conditional if="( $(wpcf-1-1-hard-labor-symptom) eq '' )"]
The field is empty when comparing to null string[/wpv-conditional]
[wpv-conditional if="( $(wpcf-1-1-hard-labor-symptom) ne '' )"]
The field has a value compared to a null string[/wpv-conditional]
[cred_user_form form='1-1-map-form-1']
TOOLSELT USER FORM
[creduserform]
<div class="form-group">
<label>[types usermeta='1-1-magical-first-name' current_user='true'][/types], all day you have been hauling large stones over a long distance. What is one way this hard labor affects your physical body?</label>
[cred_field field="1-1-hard-labor-symptom" force_type="field" class="form-control" output="bootstrap"]
</div>
[cred_field field="form_submit" output="bootstrap" value="Activate" class="btn btn-primary btn-lg"]
[/creduserform]
[wpv-conditional if="('[wpv-search-term param="_success"]' NE '')"]
Success! Your answer has been activated.
<p></p>
[/wpv-conditional]
p.s. In the 3rd and forth wpv-conditional statements above, the cut and paste makes it look like I'm using one double-quote after eq and after ne... but they are actually 2 single quotes in each instance.
Hi, I assume you're talking about this Form, correct?
hidden link
If so, where can I see it on the front-end of your site? It's not immediately obvious to me based on your description so far. Also, you should select at least one role to edit in this Form. Right now, no roles are selected. Other than that, I don't see anything obviously wrong here.
Hi Christian, yes that's the correct form.
It probably doesn't look like a normal form as I'm using it differently than most, but here is the form shortcode:
[cred_user_form form='1-1-map-form-1']
And that shortcode is at the bottom of the following post:
hidden link
I'm attaching an image of the page. The form has a single field and the label is actually a question that begins with "Ophiar" and is followed by a field where I entered the word "stronger." The Activate button is really a Toolset Submit button
I also updated the form so that all roles are checked, but the problem still persists. The two test shortcodes at the top of the attached post still indicate that the field value is blank when it is not (since I entered the word "stronger").
Thanks!
Okay the $(wpcf-field-slug) syntax isn't going to be useful with User fields. Instead, you should use the Types usermeta field shortcode like this:
[wpv-conditional if="('[types usermeta="1-1-hard-labor-symptom" output="raw"][/types]' ne '')"]The field has a value compared to a null string[/wpv-conditional]
My issue is resolved now. Thank you!