Kiwi Chris Posted February 9, 2016 Share Posted February 9, 2016 I guess it's testament to how well documented and easy to use Processwire is that I've been using it for a bit over a year without having to ask for help, after I had to use it for some contracting work, but this is the first time I've needed to modify a module so, here's my scenario: The FormTemplateProcessor works well for me in that I can allow set up of fields via the UI, and allow submission by email, but I'm thinking I'd like to make it resistant to spam. After reading up discussion on the evils of captchas and alternative methods, I thought adding a honeypot seemed like the best solution. So far so good. In the template that displays the form, I've got this: //Set notABot when user visits home page, as most normal user would before they go to form. if ($session->notABot) { ... } That works fine, but just in case there's a bad bot that crawls the site, I've also added this in the body of the template: <script type="text/javascript"> $('#wrap_Inputfield_robots').hide(); $('#Inputfield_robots').val('<?= $session->spamCheck ?>'); </script> $session->spamCheck is a random string generated when a visitor visits the site home page. It wouldn't be hard to make #wrap_Inputfield_robots a user selectable field something like $page->honeypotFieldWhat I'm trying to work out how to do is to get the FormTemplateProcessor module to check whether the field #Inputfield_robots refers to matches $session->spamCheck either in the ___sendEmail function, or better yet, in the ___render() function so $this->sendEmail($form); never gets called at all. Beyond just getting it to work, I'd like it to be as flexible as possible, so that in the template, when it's possible to do something like: $form->spamCheck = $page->hiddenFieldName$form->email = $recipient->email; so it's possible to specify if you want to have a hidden field or not, and what field should be used.I can probably work it out, but I'm feeling tired, so thought I'd ask, and also make it known how much I appreciate Processwire. Link to comment Share on other sites More sharing options...
mr-fan Posted February 9, 2016 Share Posted February 9, 2016 Hi Kiwi Chris welcome to the forums, it's a kind of good that you didn't find this post, https://processwire.com/talk/topic/59-module-want-form-builder/page-6#entry72394 where a honeypot and a emty question field is implemented, so you had to take your first post now and be a part of the community. A OS project lives from comparing and exchanging so every question and every answer is helpful for you and others... I hope this helps you out and your tiredness is gone away. Have fun with PW - regards mr-fan Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now