Skip Navigation

[Resolved] Checking if a form has been submitted

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#593787

hello, I am trying to build a cred front end submission form which shows up only to logged in user, could you please give a piece of code about conditional output.

post type: room; cred id:12; one of custom field of post: my-field, value:1;

I am not sure what factor you need, so list something above

if the number of post by current user submitted is more then 1, then output message 1234
if the number of post by current user submitted is 0, that means on post submitted, then keep original message 0000

note: this message is not used to be displayed after user submitted, I know that is a built-in feature. it is used to notice what progressive of all forms has been completed. so it is diplayed at the top of page, Please Luo take over this ticket if possible, because I have submitted a similar ticket with him already before, it will help make sense of what I want to say , please see the link https://toolset.com/forums/topic/checking-if-a-form-has-been-submitted/#post-558436.

Best regards

#593819

Dear Jeffrey,

Please try [wpv-conditional] shortcode like this:

[wpv-conditional if="( $(wpcf-my-field) eq '1' )" ] 
form has been submitted 
[/wpv-conditional]

You can put above shortcode into the content of single custom post
More help:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

#593823

Can I add user_current='true' output='raw' to restrict that current user submitted form only will be output? because I tested already, it is working incorrectly

#593835
QQ图片20171128013303.png

please check the screenshot attached.

[wpv-conditional if="( $(wpcf-my-field user_current='true' output='raw') eq '1' )"]<h5><i class="fa fa-exclamation-triangle" style="font-size: 24px;"></i> <a href="<em><u>hidden link</u></em>">Homestay demand</a></h5><h5><span style="font-size: 10pt;">Please submit a homestay demand.</span></h5>[/wpv-conditional]
 [wpv-conditional if="( $(wpcf-my-field user_current='true' output='raw') ne '1')"] <h5><i class="fa fa-check-square-o" style="font-size: 24px;color: #009900"></i> <a href="<em><u>hidden link</u></em>">Homestay demand</a></h5><h5><span style="font-size: 10pt;">You have submitted at least one homestay demand.</span></h5>[/wpv-conditional]  

could you please help check with the code for me? Thanks!

#593875

If it is the custom user field, you will need to use the user field shortcode insider wpv-conditional shortcode, for example:

[wpv-conditional if="[types usermeta='my-field' user_current='true' output='raw'][/types] eq 1"]
form has been submitted 
[/wpv-conditional]