I'm trying to get records between two dates. The user must select the initial and end dates from calendar or simple input field. My problem is that I can call an action and create a quickform, but after inserting value, it does redirect to main app instead of reloading the action.
How can I ask for values before executing the action? Is there another better approach to this?
My testing code is this one:
- Code: Select all
<?php
import('HTML/QuickForm.php');
class formulari extends HTML_QuickForm
{
function formulari()
{
parent::HTML_QuickForm('formulari', 'post');
$this->addElement('header', null, 'Digues any');
$this->addElement('text', 'any', 'Any de còmput');
$this->addElement('submit', 'submit', 'Generar');
$this->addRule('username', 'Cal un any', 'required');
}
function process()
{
$this->freeze();
echo $this->exportValue('any') . "<hr />";
}
}
class actions_inversions_semestre1 {
function handle(&$params){
$form = new formulari();
if ($form->validate())
{
$form->process();
}
$form->display();
}
}