| Jifty documentation | Contained in the Jifty distribution. |
Jifty::Web::Form::Field::Button - Add buttons to your forms
Provide the button_as_link accessor (in addition to
Jifty::Web::Form::Field's default accessors), which controls if the
button is reworked in javascript to appear as a link.
Renders the button widget.
| Jifty documentation | Contained in the Jifty distribution. |
use warnings; use strict; package Jifty::Web::Form::Field::Button; use base qw/Jifty::Web::Form::Field/; __PACKAGE__->mk_accessors(qw/button_as_link/);
sub accessors { shift->SUPER::accessors(), 'button_as_link' }
sub render_widget { my $self = shift; my $field = join( ' ', '<input', 'type="submit"', 'name="' . $self->input_name . '" ', 'value="' . Jifty->web->escape(_($self->default_value || $self->label )). '"', ($self->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;