PHP code example of innoweb / silverstripe-form-validation

1. Go to this page and download the library: Download innoweb/silverstripe-form-validation 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/ */

    

innoweb / silverstripe-form-validation example snippets


$form = Form::create($controller, 'MyForm', $fields, $actions, $validator);
$form->disableFrontendValidation();

$form = Form::create($controller, 'MyForm', $fields, $actions, $validator);
$form->disableFormSubmission();

class ValidationExtension extends Extension
{
    // needs to be run on base FormField class, otherwise it's not going to be loaded on time
    public function addCustomValidatorScripts() {
        Requirements::javascript(
            'your/custom/field-validation.js'
        );
    }
}