Closed timiwahalahti closed 7 years ago
This didn't work out of the box for me. Do I need to resave my form or something first? I just got a 404 after submitting, and weirdly the form method was GET instead of POST
Tested my branch with clean install and it worked.
404 after submit is probably because you have field named name
which is reserved for WP core. When you go to form editor with nojs fallback enabled (add_filter( 'wplf_form_nojs_fallback', '__return_true' );)
, warning about this is shown. Maybe default name field name should be changed... Method is POST only if nojs fallback is enabled.
Just noticed that success/error messages wont work if site uses default permalink structure, will fix that if (and when 😝) PR is otherwise approved.
I must have screwed up the merge somehow. Can you rebase to master and force-push so I can test? :)
Sometimes I really hate git :D Going to close this PR and make new with different branch.
As discussed in #50, this implements quite simple fallback to handler when submitting form without javascript. It can be turned on with filter.
Because some terms are reserved for WordPress core, this PR also implements check for those in fallback mode and shows error when using those terms as input names.
After successful form handling user is redirected to referrer page and thank you message is shown instead of form. When validation contains errors, message from validator is shown below form the same way as with javascript. Only downside is that inputs are cleared :/ But I think we can accept that, because browsers supports input checks quite widely. Can we?
Needs a bit more testing, updates to README and opinion about success/error handling.