I use Aura.Web_Project and I created a project in Aura/quick-starts... I want to use form in Aura, so I follow the instruction in here:
<?php
/**
* {$PROJECT_PATH}/src/App/Input/ContactForm.php
*/
namespace App\Input;
use Aura\Input\Form;
class ContactForm extends Form
{
public function init()
{
$states = array(
'AL' => 'Alabama',
'AK' => 'Alaska',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
// ...
);
// this will make sure all field names are setup as an array so you can get all fields through $_POST['contact']
$this->setName('contact');
// set input fields
// hint the view layer to treat the first_name field as a text input,
// with size and maxlength attributes
$this->setField('first_name', 'text')
->setAttribs(array(
'id' => 'first_name',
'size' => 20,
'maxlength' => 20,
));
// hint the view layer to treat the state field as a select, with a
// particular set of options (the keys are the option values,
// and the values are the displayed text)
$this->setField('state', 'select')
->setAttribs(array(
'id' => 'state',
))
->setOptions($states);
$this->setField('message', 'textarea')
->setAttribs([
'id' => 'message',
'cols' => 40,
'rows' => 5,
]);
// etc.
// get filter object
$filter = $this->getFilter();
// set your filters.
$filter->addSoftRule('first_name', $filter::IS, 'string');
$filter->addSoftRule('first_name', $filter::IS, 'strlenMin', 4);
$filter->addSoftRule('state', $filter::IS, 'inKeys', array_keys($states));
$filter->addSoftRule('message', $filter::IS, 'string');
$filter->addSoftRule('message', $filter::IS, 'strlenMin', 6);
}
}
And the error picture is above. Would you mind helping me?