How to save data POSTed from From into database not using Form->setModel()

I know that’s kinda simple and lame question, but still.

I have a Form which should not show all Model fields, but only some of them. That’s why I can’t use Form->setModel($m), because that’ll automatically add all fields into Form.

So I add Model into page, then add form into page and then use form->importFields like this:

$m = $p->add('Model_Example');
$f = $p->add('Form');
//$f->setModel($m); // can't use this because that'll import all model fields
$f->importFields($m,array('id','description'));
$f->addSubmit('Save');

What I don’t understand in this situation is – how to save this data in database, because $f->update() in onSubmit event will not work. Basically nothing I tried will work because Form have no associated Model (with setModel).

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories