Form::Factory::Feature::Control::FillOnAssignment - Control gets the value of the attribute


Form-Factory documentation  | view source Contained in the Form-Factory distribution.

Index


NAME

Top

Form::Factory::Feature::Control::FillOnAssignment - Control gets the value of the attribute

VERSION

Top

version 0.020

SYNOPSIS

Top

  package MyApp::Action::Thing;
  use Form::Factory::Processor;

  has_control title => (
      control   => 'text',
      features  => {
          fill_on_assignment => 1,
      },
  );

  package Somewhere::Else;

  my $interface = Form::Factory->new_interface('HTML');
  my $action = $itnerface->new_action('MyApp::Action::Thing' => {
      title => 'Some preset title',
  });

  $action->render; # outputs an INPUT with value="Some preset title"

  $action->title('A different value');

  $action->render; # outputs an INPUT with value="A different value"

DESCRIPTION

Top

This feature adds a trigger to the control so that any assignment to the action value causes the control to also gain that value.

ATTRIBUTES

Top

slot

This names the slot that will be filled with the value. This must be either value or default_value. The default is default_value.

METHODS

Top

check_control

No op.

build_attribute

This modifies the attribute being created to have a trigger that causes the default value of the control to gain the value of the action's attribute on set. Unless no_warning is set, this will cause a warning if the "is" setting is not set to "rw".

initialize_control

After the control is initialized, this will set the default value of the control to the value currently held by the action attribute.

AUTHOR

Top

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Top


Form-Factory documentation  | view source Contained in the Form-Factory distribution.