[Catalyst] html::widget
Will Smith
willbelair at yahoo.com
Wed Dec 6 23:16:06 GMT 2006
THANK YOU, that's all I need to know.
"Hermida, Leandro" <Leandro.Hermida at fmi.ch> wrote:
Hello,
I am no DBIx::Class expert but I think one way of doing it is first
using the primary key or a unique constraint of the table Book to
find the object you want and then update it. Something like
this:
my $book = $c->model('MyApp::Book')->find($book_pk_id);
$book->title($new_title);
$book->rating($new_rating);
$book->update;
Leandro
________________________________
From: Will Smith [mailto:willbelair at yahoo.com]
Sent: Wednesday, December 06, 2006 21:53
To: catalyst
Subject: [Catalyst] html::widget
Hi,
It's pretty neat to use html::widget to create/validate html
form. Problem is I need to create a lot of customized html forms that
could not done easily with html::widget. I want to simply do my own html
form and use a normal action to update the record.
I tried to use somehing like:
my $book = $c->model('myapp::Book')->update({
title => $title,
rating => $rating,
});
but of course, it updates the whole table, not only the wanted
record, because I do not put in the condition "where".
I used to use : update_from_form in older version of catalyst.
Could someone please show me the syntax to do the update, either
adding condition to the above method (which I think there is a simple
way), or using update_from_form
something like the old timer:
$c->for( optional => [ myapp::M::CDBI::books->columns ] );
..
myapp::M::CDBI::books->retrieve($id)->update_from_form(
$c->form);
Thank you
_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
---------------------------------
Need a quick answer? Get one in minutes from people who know. Ask your question on Yahoo! Answers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20061206/fe0ab189/attachment-0001.htm
More information about the Catalyst
mailing list