for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Anax\HTMLForm;
use Anax\DI\DIInterface;
/**
* Example of FormModel implementation.
*/
class FormModelValidateNumber extends FormModel
{
* Constructor injects with DI container.
*
* @param Anax\DI\DIInterface $di a service container
public function __construct(DIInterface $di)
parent::__construct($di);
$this->form->create(
[
"id" => __CLASS__,
"legend" => "Legend",
],
"num1" => [
"type" =>"text",
"label" => "Numeric (as input type=text)",
"validation" => ["number"],
"num2" => [
"type" =>"number",
"label" => "Numeric (as input type=number)",
"num3" => [
"type" =>"range",
"label" => "Numeric (as input type=range)",
"value" => 42,
"min" => 0,
"max" => 100,
"step" => 2,
"submit" => [
"type" => "submit",
"value" => "Submit",
"callback" => [$this, "callbackSubmit"]
]
);
}
* Callback for submit-button which should return true if it could
* carry out its work and false if something failed.
* @return boolean true if okey, false if something went wrong.
public function callbackSubmit()
$this->form->addOutput("Validation passes.");
// Remember values during resubmit, for sake of the example
$this->form->rememberValues();
return true;