I am trying to conditionally display a field value and a text inside a table cell in a cred form:
This DON'T WORK
<tr>
<th class="tg-au6fr">ACTION ID</th>
<th class="tg-ioj1l">[types field='actionid'][/types][cred_show_group if="( $(pactionid) ne 'pippo' )" mode="none"] (derived from hidden link">xx[types field='pactionid'][/types])[/cred_show_group]
</th>
</tr>
Also This DON'T WORK
<tr>
<th class="tg-au6fr">ACTION ID</th>
<th class="tg-ioj1l">[types field='actionid'][/types]</th>
</tr>
<tr>
<th class="tg-au6fr">PARENT</th>
<th class="tg-ioj1l">[cred_show_group if="( $(pactionid) ne 'pippo' )" mode="none"] (derived from hidden link">xx[types field='pactionid'][/types])[/cred_show_group]</th>
</tr>
THIS WORKS!:
[cred_show_group if="( $(pactionid) ne 'pippo' )" mode="none"]
<tr>
<th class="tg-au6fr">PARENT</th>
<th class="tg-ioj1l">(derived from hidden link">xx[types field='pactionid'][/types])</th>
</tr>
[/cred_show_group]
At the same time, wpv-conditional doesn't seem to work inside a cred form
hidden link
I expected to see: the text inside the shortcode
Instead, I got:
- nothing when i use cred_showgroup (data is present in HTML but is marked as "display:none")
- the shortcode code when i use wpv-conditional
Hi,
Thank you for contacting us and I'd be happy to assist.
I've performed some tests on my website and the "cred_show_group" shortcode seems to work as expected from inside the "td" and "th" tags.
Since the "cred_show_group" shortcode inserts a "div" tag around the fields wrapped in the conditional block, it is important that it is used in a way that form's HTML remains valid.
Note: the hidden "div" tag containers that you see in the form are expected and that's how the "cred_show_group" shortcode shows/hides the fields, based on the form's input.
Also, the "wpv-conditional" shortcode also works from inside the form, but it is important to understand the scope of the current item. For example, if you'll use "wpv-post-id" shortcode, inside the form to add new post, it will return the ID of the current page, where the form is inserted and not the ID of the post that will be created.
You're welcome to share temporary admin login details along with the link to the page with forms, in case the issues still persist.
Note: Your next reply will be private and though no changes will be made on your website, please make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing the admin access.
During troubleshooting, I noticed that the shortcode "wpv-conditional" was showing as it is because of longer dash character.
Instead of "-" the opening and closing of that shortcode is using "–". Please replace both instances of "wpv–conditional" with "wpv-conditional".
Also, the enclosed bracket is started outside the link tag, so it should end outside it too.
Incorrect:
[wpv–conditional if="( $(pactionid) eq 'pippo' )"](derived from <a href="<em><u>hidden link</u></em>">xx[types field='pactionid'][/types])</a>[/wpv–conditional]
Correct:
[wpv–conditional if="( $(pactionid) eq 'pippo' )"](derived from <a href="<em><u>hidden link</u></em>">xx[types field='pactionid'][/types]</a>)[/wpv–conditional]
The "cred_show_group" shortcodes are all wrapped outside the tr tags in the table and when the div for the conditional wrapper is included, this makes your page's markup invalid.
To avoid this you can insert a new table in the tr tag and wrap it in the conditional shortcode so that the entire table shows or hides.
For example, currently, you have:
[cred_show_group if="( $(pactionid) ne 'pippo' )" mode="none"]
<tr>
<th class="tg-au6fr">PARENT</th>
<th class="tg-ioj1l"></th>
</tr>
[/cred_show_group]
You can change it to:
<tr>
<td colspan="2">
[cred_show_group if="( $(pactionid) ne 'pippo' )" mode="none"]
<table>
<tr>
<th class="tg-au6fr">PARENT</th>
<th class="tg-ioj1l"></th>
</tr>
</table>
[/cred_show_group]
</td>
</tr>
I hope this helps and please let me know how it goes.
My issue is resolved now. Thank you for your support!