I am using cred to create several user forms and a post form, for remanding purpose, my system must check if each form has been submitted, and display onto a alert box, for example, A has been submitted, B Please complete you form as earlier as possible. and I have read some article about how to check submission for forms. below seems a better solution
<form action="" method="POST" id="formaddtask">
Add Task: <input type="text"name="newtaskname" />
<input type="submit" value="Submit"/>
</form>
//Check if the form is submitted
if($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['newtaskname'])){
}
for my forms
[cred_user_form form='host-location-and-contact' form_name='Host location and contact']
and form submit
[cred_field field='form_submit' value='Submit' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']
My question is how to revise parameter? where to place those 2 pieces of code? will it meet my demands? Thank you so much.
https://stackoverflow.com/questions/7711466/checking-if-form-has-been-submitted-php this is that external link to stackoverflow.com
Dear jianfengZ,
There is a built-in feature within CRED form, when user submit a CRED form, you can display a message with your custom HTML codes, for example, you can try this:
Edit the CRED form, in section "Settings", option "After visitors submit this form" choose "Display a message instead of the form...", there you can can use HTML and shortcodes. (but no CRED Forms)
Hi Mr. Yang, thank you so much for you reply. your explanation is very suitable for me. Along your recommendation, I also want to display those messages on the progress bar which is on the top of page content. before the page submitted, that bar shows original words, after submitted, that shows:
1. that message instead of origin, I guess that it needs quotation.
2. or shows progressive. I guess this solution is harder than displaying messages, because it needs conditional output.
that depends on which is suitable for me.
I have looked for many information about it, both of English and Chinese. Sorry, I have to continue this ticket, some information from stackoverflow is very difficult to me :(.
could you please teach me how to do that? Thanks!
for your new question:
I also want to display those messages on the progress bar which is on the top of page content. before the page submitted, that bar shows original words, after submitted
How do you setup the "progress bar"? could you describe detail steps to duplicate same problem?
I need to test and debug it in my localhos, thanks
我想了一下可能还是不能使用系统自带的功能,display a message instead of the form. 因为我想把几个表单使用 “”提交后,前往**页面“功能把几个表单连起来。 我需要用户在后台填写多个表单(包含2个用户表单和文章表单)这样的话,我需要在页面的顶上做一个提醒(我叫他progress bar :))就像上一个留言框里我的截图一样,”A表单未完成,请尽快完成填写“ ”B 表单提交成功“ 类似这样的东西。 需要根据表单的提交动作,条件输出。 conditional output 里面实在找不到能够判断 表单是否提交成功的办法,所以我想是不是可以得到求助。 谢谢!为了清晰的表达 我还是在下面的截图上给你圈一下。
我建议你为每个CRED 表单建立一个单独的custom field, 比如:
用户提交了 “CRED 表单 A”, 那么就把 custom field A 的值设置为1,然后使用 [wpv-conditional] 根据 custom field A 的值显示你需要的内容了
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
哦! 我怎么没想到~~~ 谢谢你! 我试试 如果实施成功 我就关闭ticket! :)
不好意思,还是要寻求帮助。能否帮我看看两种情况的代码怎么写 🙂 举例来说:
conditional output for custom usermeta fields
如果当前用户的(我不知道是否需要添加当前用户的限制条件,这个是用户在登陆状态下填写的表单)表单的 cred id=5, 字段名称为[types usermeta="wpcf-user-english-level"][/types]
如果 用户字段值大于1,输出 1234
conditional output for custom post fields
如果 当前用户的 表单 cred id=8 字段名称为[types field='room-type'][/types]
如果字段值大于1 输出 3456
这种情况这么写? 我看到这部分的条件很多,我实在是拿不准怎么写。 文章到看了好几篇。还是弄不出来 🙁 谢谢!
新问题1:如果当前用户的(我不知道是否需要添加当前用户的限制条件,这个是用户在登陆状态下填写的表单)表单的 cred id=5, 字段名称为[types usermeta="wpcf-user-english-level"][/types]
如果 用户字段值大于1,输出 1234
你可以使用下面的代码获取当前用户的用户字段“user-english-level”值:
[types usermeta='user-english-level' user_current='true' output='raw'][/types]
https://toolset.com/documentation/customizing-sites-using-php/functions/#numeric
然后用上面的值在shortcode [wpv-conditional]里面,比如:
[wpv-conditional if="[types usermeta='user-english-level' user_current='true' output='raw'][/types] gt 1"]
1234
[/wpv-conditional]
问题2) 如果 当前用户的 表单 cred id=8 字段名称为[types field='room-type'][/types],如果字段值大于1 输出 3456
你应该是指在CRED表单里面,当用户选择room-type为一个特定值1,显示特定内容,如果我猜的不错,请你参考我们的文档进行设置
Advanced Conditional Display for Form Sections
https://toolset.com/documentation/user-guides/cred-conditional-display-engine/
最后请为新问题开新帖,方便大家,谢谢!