Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

FormAction display query


Reply


3 Posts   1117 Views

Avatar
hairiemx

Community Member, 6 Posts

25 September 2008 at 2:22pm

How to use FormAction to display query from DataObject?

Avatar
Willr

Forum Moderator, 5513 Posts

25 September 2008 at 4:42pm

well formaction fires a function. You can see what function when you make your form

new FormAction("doSomethingCool", "Do Something");

and that will call a function called doSomethingCool which should be in the same file as that last piece of code (not the same function but in the same file). The doSomethingCool function recieves 2 pieces of data - the form and the data in the form so it would look something like

function doSomethingCool($data, $form) {
// the $data stores all the values in the form. You can access it like any array eg $data['SomeField'];
}

and in that function it will where you would do your DataObject query.

Avatar
hairiemx

Community Member, 6 Posts

25 September 2008 at 10:00pm

Edited: 25/09/2008 10:01pm

By referring to your example, from doSomethingCool, i don't know how to make the DataObject query available to the template.

Currently what I did in the form action is, I cache the field value into Session and redirect to another page that will read the field value from session and do the query.

What I'm trying to do is to create SearchForm (with multiple field) for specific DataObject and display the result of the search.