n0sleeves Posted January 22, 2015 Posted January 22, 2015 I like the one at tectite.com but curious as to what everyone else is using. Finding any on google seems to bring up some pretty old and unsafe techniques. I don't like paid services like Jot Form, etc. Ryan's form script is awesome and is what I usually use. However, sometimes I don't get to use PW on projects
LostKobrakai Posted January 23, 2015 Posted January 23, 2015 I've had a good time using valitron at one time. Have a look here about in and it's use in pw: https://processwire.com/talk/topic/7763-form-validation-with-valitron-library/
vps Posted March 6, 2015 Posted March 6, 2015 I've had a good time using valitron at one time. Have a look here about in and it's use in pw: https://processwire.com/talk/topic/7763-form-validation-with-valitron-library/ I have used valitron, Do you know any other alternative to this script?
ukyo Posted March 8, 2015 Posted March 8, 2015 My solution for simple forms : Validation Module I used GUMP validation library with my custom usage additions. You can check my usage additions : https://github.com/trk/Validation/blob/master/README.md#example-long-format Also i wrote recaptcha module for form security, but didn't publish it yet: https://github.com/trk/Recaptcha Usage: $recaptcha = wire('modules')->get('Recaptcha')->verifyResponse($_POST['g-recaptcha-response']); if(!$recaptcha) { echo 'reCAPTCHA validation not ok!'; } You can add recaptcha as a rule to validation module like: 'g-recaptcha-response' => array( 'label' => 'Security Question', 'rule' => 'required|boolean', 'type' => 'captcha' ) 1
Nico Knoll Posted March 28, 2015 Posted March 28, 2015 Recaptcha module looks nice. You should add it to the modules directory Just a quick tip: please use wire('input')->post->g-recaptcha-response instead of $_POST (if possible). 2
Beluga Posted July 20, 2015 Posted July 20, 2015 I thought I'd post this example of a working solution of ukyo's module with FrontendUser. Thanks to ukyo & pwFoo for troubleshooting and everything. <?php if(!$user->isLoggedin()) { // load module $fu = $modules->get('FrontendUser'); $recaptcha = $modules->get('Recaptcha'); // prepare register form $fu->register(); $form = $fu->form; // process register / form submit $redirectDestination = $pages->get(1)->url; $form->addHookAfter('processInput', function() use($fu, $recaptcha, $input) { if(isset($input->post) && $input->post('fuRegisterForm') == 'fuRegisterForm') { $recaptchaverify = $recaptcha->verifyResponse($input->post('g-recaptcha-response')); if(!$recaptchaverify) { $fu->form->fhSubmitBtn->error('reCAPTCHA validation not ok!'); } } }); $fu->process($redirectDestination); ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php echo $title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $templatesurl; ?>css/mystyle.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $templatesurl; ?>css/somestyle.css" /> </head> <body> <div class="container"> <p>Ylläpito vahvistaa kaikki rekisteröitymiset. Saat sähköpostia, kun olet saanut käyttöoikeudet.</p> <?php // output register form echo $fu->render(); echo $recaptcha->render(); ?> </div> </body> </html> <?php die(); }
Recommended Posts