HTML :: FormHandler访问表单域

时间:2014-10-03 00:08:51

标签: perl html-formhandler

有没有办法访问表单字段的值' wklloc_id'在字段' prg_id'?

的表单字段选项方法中

我的表格包含(以及其他)这些字段:

has_field 'wklloc_id' => ( type => 'Select', label => 'Winkel(locatie)' );
has_field 'prg_id' => ( type => 'Select', empty_select => 'Kies eerst een Winkel(locatie)', label => 'Productgroep' );

此时我的字段' prg_id'的选项方法包含:

sub options_prg_id
{
  my ($self) = shift;

  my (@prg_select_list,$productgroep,$productgroepen);

  return unless ($self->schema);

  $productgroepen = $self->schema->resultset( 'WinkelLocatieProductgroepen' )->search( {}, { bind  => [ 2 ] } );

是否可以将绑定变量(即2)的值设置为字段' wklloc_id'的值。怎么做到这一点?请注意,在提交之前需要这样做。

1 个答案:

答案 0 :(得分:2)

select字段的值设置方式与其他字段相同,即它来自init_object,来自参数值,或来自默认值。对于您的情况,如果您希望此字段以'值'开头。 2,然后只需输入:default => 2,在你的字段定义中。

相关问题