Esempio n. 1
0
 /**
  * (non-PHPdoc)
  * @see \Codeception\TestCase\Test::_before()
  */
 protected function _before()
 {
     // always english for testing
     $t = \WinkForm\Translation\Translator::getInstance();
     $t->setLocale('en');
     $this->validator = new FormValidator();
 }
Esempio n. 2
0
 /**
  * create Validator
  */
 public function __construct()
 {
     // To display the laravel Validator error messages, the Translator is required.
     // We create a translator object that searches for files in the 'lang' folder
     // lang/{locale}/{domain}.php
     // by default: lang/en/validation.php
     // you can download the default validation.php in your language at
     // @see https://github.com/caouecs/Laravel4-lang
     $this->translator = Translator::getInstance();
     // fetch the allowed rules by reading the Validator validate methods
     $this->fetchRules();
     // init
     $this->init();
 }
Esempio n. 3
0
 protected function _before()
 {
     $this->trans = \WinkForm\Translation\Translator::getInstance();
 }
Esempio n. 4
0
<?php

// require the library
require_once '../vendor/autoload.php';
// force English version test form
$t = \WinkForm\Translation\Translator::getInstance();
$t->setLocale('en');
// typically your own autoloader should be configured to look in your forms directory
require_once 'TestForm.php';
// create the form
$form = new TestForm();
if ($form->isPosted() && !$form->validate()) {
    echo error('Can\'t process form, because not all fields are filled correctly');
}
// for sake of the example the html and css is inline here
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Form Example</title>

    <!-- DateInput uses jquery ui date picker -->
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">

    <!-- ChainedDropdowns uses this jquery plugin -->
    <script src="js/jquery.chained.min.js"></script>

    <!-- This script is required to use the placeholder attribute in IE -->
Esempio n. 5
0
 /**
  * (non-PHPdoc)
  * @see \WinkForm\Input\Input::isPosted()
  */
 public function isPosted()
 {
     $translator = Translator::getInstance();
     return $this->postcode->isPosted() && $this->houseNumber->isPosted() && $this->postcode->getPosted() != $translator->get('inputs.postal-code') && $this->houseNumber->getPosted() != $translator->get('inputs.house-number');
 }