<div>you can use this to add value to a text field:</div>  <div>my $e = $w-&gt;element('Textfield', 'itemid' )-&gt;label('ItemId')-&gt;value(...)-&gt;size(30);<BR><BR><BR><B><I>Hans Ophüls &lt;hop@shoppilot.de&gt;</I></B> wrote:</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>&gt; But I have a problem with implementing an<BR>&gt; update function.<BR>&gt; It schould select a record from the database<BR>&gt; and insert the data into a widget.<BR>&gt; <BR>&gt; sub hw_update : Local {<BR>&gt; my ($self, $c, $id) = @_;<BR>&gt; <BR>&gt; # Search for the product <BR>&gt; c-&gt;model('MyAppDB::Product')-&gt;search({id =&gt; $id});<BR>&gt; <BR>&gt; # Create the widget and set the action for the form<BR>&gt; my $w = $self-&gt;make_product_widget($c);<BR>&gt; $w-&gt;action($c-&gt;uri_for('hw_create_do'));<BR>&gt; <BR>&gt; ....<BR>&gt; <BR>&gt; sub make_product_widget {<BR>&gt; my ($self, $c) = @_;<BR>&gt; <BR>&gt; #
 Create an HTML::Widget to build the form<BR>&gt; my $w = $c-&gt;widget('product_form')-&gt;method('post');<BR>&gt; <BR>&gt; # Create the form fields<BR>&gt; my $e = $w-&gt;element('Textfield', 'itemid' <BR>&gt; )-&gt;label('ItemId')-&gt;size(30);<BR>&gt; $e-&gt;value('4711');<BR>&gt; <BR>&gt; Just where there is '4711' should be the value from the <BR>&gt; column 'itemid'.<BR>&gt; I have tried various expression with<BR>&gt; $c-&gt;model('MyAppDB::Product')...<BR>&gt; but I have not found the right way.<BR><BR>I have found a way to do it.<BR><BR>sub hw_update : Local {<BR>my ($self, $c, $id) = @_;<BR>$c-&gt;stash-&gt;{product} = $c-&gt;model('MyAppDB::Product')-&gt;search({id =&gt; $id});<BR># Create the widget and set the action for the form<BR>my $w = $self-&gt;make_product_widget($c);<BR>$w-&gt;action($c-&gt;uri_for('hw_create_do'));<BR><BR>....<BR><BR>sub make_product_widget {<BR>my ($self, $c) = @_;<BR><BR># Create an HTML::Widget to build the form<BR>my $w =
 $c-&gt;widget('product_form')-&gt;method('post');<BR><BR>if (defined $c-&gt;stash-&gt;{product}) { # update<BR><BR>my $firstrecord = $c-&gt;stash-&gt;{product}-&gt;next;<BR><BR># Create the form fields<BR>my $e = $w-&gt;element('Textfield', 'itemid' )-&gt;label('ItemId')-&gt;size(30);<BR>$e-&gt;value($firstrecord-&gt;itemid);<BR>...<BR>} else { # create<BR>...<BR><BR>I don't now if this is best way to do it.<BR>But I have now a widget, which can be used for update and create operation.<BR><BR>But something goes wrong with Umlaut i.e. üäö .<BR>They are stored in the database as Unicode. <BR>Also all Pages are deliverd with utf-8 charset.<BR><BR>But in the update form those characters are not displayed<BR>correctly (In the product list they are displayed correctly).<BR>It seems to me that something goes wrong with my<BR><BR>$e-&gt;value($firstrecord-&gt;itemid);<BR><BR>Any ideas ?<BR><BR>Hans<BR><BR><BR>_______________________________________________<BR>List:
 Catalyst@lists.rawmode.org<BR>Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst<BR>Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/<BR>Dev site: http://dev.catalyst.perl.org/<BR></BLOCKQUOTE><BR><p>&#32;

<hr size=1>Need Mail bonding?<br>Go to the <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">Yahoo! Mail Q&A</a> for <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">great tips from Yahoo! Answers</a> users.