| 1 | package HTML::TurboForm::Element::Submit; | ||
| 2 | use warnings; | ||
| 3 | use strict; | ||
| 4 | use base qw(HTML::TurboForm::Element); | ||
| 5 | __PACKAGE__->mk_accessors( qw/ image pure ajaxcall / ); | ||
| 6 | |||
| 7 | sub render{ | ||
| 8 | my ($self, $options, $view)=@_; | ||
| 9 | if ($view) { $self->{view}=$view; } | ||
| 10 | my $result=''; | ||
| 11 | my $disabled=''; | ||
| 12 | |||
| 13 | if ($self->label and ($self->label eq '')) { | ||
| 14 | $self->label(' '); | ||
| 15 | } | ||
| 16 | |||
| 17 | my $class= "form_std"; | ||
| 18 | $class=$self->class if ($self->class); | ||
| 19 | |||
| 20 | my $id=''; | ||
| 21 | $id=" id='$self->{name}' "; | ||
| 22 | |||
| 23 | my $value=$self->value; | ||
| 24 | $value= ' value="'.$value.'" '; | ||
| 25 | |||
| 26 | if ($options->{frozen}){ | ||
| 27 | if ($options->{frozen} == 1) { | ||
| 28 | my $text= $value; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | my $js_tag_text = ''; | ||
| 33 | if ($self->ajaxcall) { | ||
| 34 | $result= '<input type="hidden" name="'.$self->name.'" value="1"/>'; | ||
| 35 | $result= $result.'<input type="Button" class="'.$class.'" onClick="get_box_data('."'".$self->ajaxcall."'".');" value="'.$self->{value}.'"></input> '; | ||
| 36 | } else { | ||
| 37 | my $t = 'type="Submit"'; | ||
| 38 | $t = 'type="image" src="'.$self->image.'"' if ($self->image); | ||
| 39 | $result =$result.'<input class="'.$class.'" '.$t.' '.$id.' name="'.$self->{name}.'" '.$value.' />' ; | ||
| 40 | } | ||
| 41 | return $result if ($self->{pure}); | ||
| 42 | return $self->vor($options).$result.$self->nach; | ||
| 43 | } | ||
| 44 | |||
| 45 | sub get_dbix{ | ||
| 46 | my ($self)=@_; | ||
| 47 | return 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | 1; | ||
| 51 | |||
| 52 | |||
| 53 | __END__ |