| 1 | use warnings; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | package Jifty::Web::Form::Field::ResetButton; | ||
| 5 | |||
| 6 | use base qw/Jifty::Web::Form::Field::InlineButton/; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Jifty::Web::Form::Field::ResetButton - Add a reset button to your forms | ||
| 11 | |||
| 12 | =head1 METHODS | ||
| 13 | |||
| 14 | =head2 render_widget | ||
| 15 | |||
| 16 | Renders the reset button widget | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | sub render_widget { | ||
| 21 | my $self = shift; | ||
| 22 | my $field = join( | ||
| 23 | ' ', | ||
| 24 | '<input', | ||
| 25 | 'type="reset"', | ||
| 26 | 'name="' . $self->input_name . '" ', | ||
| 27 | ($self->title ? 'title="'.$self->title.'" ' : ''), | ||
| 28 | 'value="' . _($self->label ). '"', | ||
| 29 | $self->_widget_class('button', 'reset'), | ||
| 30 | $self->javascript, | ||
| 31 | ' />', | ||
| 32 | "\n" | ||
| 33 | ); | ||
| 34 | Jifty->web->out($field); | ||
| 35 | return ''; | ||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | 1; |