PHP code example of azt3k / abc-silverstripe-textcap

1. Go to this page and download the library: Download azt3k/abc-silverstripe-textcap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

azt3k / abc-silverstripe-textcap example snippets


AbcTextCap::set_text_captcha_api_key('your-api-key');



class ContactForm extends Form {

    public function __construct($controller, $name){

        $fields = new FieldList;

        $fields->push(new TextField('Name', 'Your Name'));
        $fields->push(new EmailField('Email', 'Your Email'));
        $fields->push(new TextField('Subject'));
        $fields->push(new TextareaField('Message', 'Message'));
        $fields->push(new AbcTextCapField('Captcha','Are you a human?'));

        // Actions
        $actions = new FieldList(new FormAction("doProcessForm", 'Send'));

        // Validator
        $essage has been sent", 'good');

        // go back to the last location
        $this->Controller()->redirectBack();
        return;

    }

}