Page 1 of 1

Input form inside action

PostPosted: Mon Feb 07, 2011 10:34 am
by jvinolas
Hi,

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();
}
}

Re: Input form inside action

PostPosted: Mon Feb 07, 2011 10:50 pm
by shannah
You need to include the -action parameter to tell your form to post back to your action.
e.g
Code: Select all
$form->addElement('hidden', '-action', 'inversions_semestre1');

Re: Input form inside action

PostPosted: Tue Feb 08, 2011 9:08 am
by jvinolas
It worked perfecty!

I already voted and raed for your code in the links you provide on main page. I would like to donate something also for this code and for your quick and accurate support to those who are developing apps with your code. I do realize that you spent lots of hours coding and also giving us support.

How can we donate something? Is there any link to pay-pal or others?

Thanks a lot!

Re: Input form inside action

PostPosted: Wed Feb 09, 2011 10:20 am
by shannah
Thanks for the rating!

Really the best way to support the project is to share it with others. If you're doing interesting things with Xataface, why not blog about it? Also if you happen to see parts of the wiki that need fixing, please feel free to improve it (you can log into the wiki with your forum username/password)... or if you recognize parts that are incorrect, unclear, or incomplete but you don't know how to fix it yourself, you could just post a comment on the wiki page to point it out or ask a question.

-Steve