On 1/10/2012 7:48 PM, Gabor HALASZ wrote:

$position = $c->stash->{form}->get_all_element({ type => 'File', });

$position->parent->insert_after( $c->stash->{form}->element( {
name => $productId,
src => $c->uri_for( '/api/getproducticon/' . $productId ),
type => 'Image',
} ), $position );

Any idea?

Ok, I found the answer in t/block_insert_before.t :) The new element must derivated from the parent object, so next code :

$position->parent->insert_after(
 $position->parent->element( {
  name => $productId,
  src => $c->uri_for( '/api/getproducticon/' . $productId ),
  type => 'Image',
 } ),
 $position
);

wokrs correctly. I think, this need to be documented in the cookbook and man pages.

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to