The Aura.Input itself contains a basic filter implementation. As shown
in earlier post Aura Turns 2
But in this post let us use the power of Aura.Filter. As Aura.Input
doesn’t have a rendering capability you may need to use Aura.View as
templating system ( see Using Aura.View ) or use the helper classes provided by Aura.View
( see below Without using Aura.View completely )
or create your own helper classes to render the same from the hints
( see Hints for the view ).
1 ) fill() method helps us to fill the data values
2 ) filter() method which helps to filter and validate data according to
the rules specified in the form.
The code will looks like
12345678910
if($_POST&&$_POST['submit']=='send'){$data=$_POST;$form->fill($data);if($form->filter()){//echo"Yes successfully validated and filtered";var_dump($data);exit;}}
The form element gives you hints for the view. An example from the above
Hints for the view
1234567891011121314151617181920
// get the hints for the name field$hints=$form->get('name');// the hints array looks like this:$hints=array('type'=>'text','name'=>'name','attribs'=>array('id'=>'name','type'=>NULL,'name'=>NULL,'size'=>20,'maxlength'=>20,),'options'=>array(),'value'=>NULL,)
Without using Aura.View completely
If you are not planning to use Aura.View entirely as templating, you can
make use of Aura.View helpers which can render to make the form.
For that you need to instantiate Aura\View\HelperLocator and get the
field object as below.