Input form inside action

A place for users and developers of the Xataface to discuss and receive support.

Input form inside action

Postby jvinolas » Mon Feb 07, 2011 10:34 am

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();
}
}
jvinolas
 
Posts: 51
Joined: Thu Apr 15, 2010 12:31 am

Re: Input form inside action

Postby shannah » Mon Feb 07, 2011 10:50 pm

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');
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Input form inside action

Postby jvinolas » Tue Feb 08, 2011 9:08 am

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!
jvinolas
 
Posts: 51
Joined: Thu Apr 15, 2010 12:31 am

Re: Input form inside action

Postby shannah » Wed Feb 09, 2011 10:20 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 22 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved