use warnings; use strict; package Jifty::Web::Form::Field::Button; use base qw/Jifty::Web::Form::Field/; __PACKAGE__->mk_accessors(qw/button_as_link/); =head1 NAME Jifty::Web::Form::Field::Button - Add buttons to your forms =cut =head1 SUMMARY L is a L =head1 METHODS =head2 accessors Provide the C accessor (in addition to L's default accessors), which controls if the button is reworked in javascript to appear as a link. =cut sub accessors { shift->SUPER::accessors(), 'button_as_link' } =head2 render_widget Renders the button widget. =cut sub render_widget { my $self = shift; my $field = join( ' ', 'title ? qq( title="@{[$self->title]}") : ''), 'id="'. Jifty->web->serial . '"', ($self->key_binding ? qq( accesskey="@{[$self->key_binding]}") : ''), $self->_widget_class('button', ($self->button_as_link ? ("button_as_link") : ())), $self->javascript, ' />', "\n" ); Jifty->web->out($field); return ''; } 1;