NAME
Form::Factory::Feature::Control::FillOnAssignment - Control gets the value of the attribute
VERSION
version 0.011
SYNOPSIS
package MyApp::Action::Thing;
our $VERSION = '0.011';
use Form::Factory::Processor;
has_control title => (
control => 'text',
features => {
fill_on_assignment => 1,
},
);
package Somewhere::Else;
our $VERSION = '0.011';
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
This feature adds a trigger to the control so that any assignment to the action value causes the control to also gain that value.
METHODS
check_control
This works with Form::Factory::Control::Role::ScalarValue and Form::Factory::Control::Role::ListValue controls.
build_attribute
This modifies the attribute being created to have a trigger
that causes the control to gain the value of the action's attribute on set. Unless no_warn
is set, this will cause a warning if the "is" setting is not set to "rw".
build_control
This modifies the control such that it will be initialized to the correct value when the control is created.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2009 Qubling Software LLC.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.