| 1 | package HTML::FormBuilder::FieldSet; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use 5.008_005; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use HTML::FormBuilder::Field; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use Scalar::Util qw(weaken blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | extends qw(HTML::FormBuilder::Base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 10 | our $VERSION = '0.12'; ## VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | has data => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | isa => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 26 | ▶ | my $data = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 26 | ▶ | croak('data should be a hashref') unless ref($data) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | has fields => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | isa => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 26 | ▶ | my $fields = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 26 | ▶ | croak('fields should be an arrayref') unless ref($fields) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 26 | ▶ | []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | sub add_field { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 97 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 97 | my $_args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 97 | my $field = HTML::FormBuilder::Field->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | data => $_args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | classes => $self->classes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | localize => $self->localize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 97 | push @{$self->{'fields'}}, $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 97 | return $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | sub add_fields { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | my ($self, @field_args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_fields: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | for my $field_arg (@field_args) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | $self->add_field($field_arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | return scalar @field_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # Usage : generate the form content for a fieldset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # Purpose : check and parse the parameters and generate the form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # properly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Returns : a piece of form HTML for a fieldset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # Parameters : fieldset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # Comments : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # See Also : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | sub build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 18 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=10 SCAR=23.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 18 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | #FIXME this attribute should be deleted, or it will emit to the html code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 18 | my $fieldset_group = $data->{'group'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 18 | ▶ | my $stacked = defined $data->{'stacked'} ? $data->{'stacked'} : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 18 | ▶ | if (not $fieldset_group) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 17 | $fieldset_group = 'no-group'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 18 | my $fieldset_html = $self->_build_fieldset_foreword(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 18 | my $input_fields_html = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 18 | foreach my $input_field (@{$self->{'fields'}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 71 | $input_fields_html .= $input_field->build({stacked => $stacked}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 18 | ▶ | if ($stacked == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | $input_fields_html = $self->_build_element_and_attributes('div', {class => $self->{classes}{'no_stack_field_parent'}}, $input_fields_html); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 18 | $fieldset_html .= $input_fields_html; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # message at the bottom of the fieldset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 18 | ▶ | if (defined $data->{'footer'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | my $footer = delete $data->{'footer'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | $fieldset_html .= qq{<div class="$self->{classes}{fieldset_footer}">$footer</div>}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 18 | $fieldset_html = $self->_build_element_and_attributes('fieldset', $data, $fieldset_html); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 18 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
!$data->{"id"} || $data->{"id"} ne "formlayout" and not $data->{"class"} && $data->{"class"} =~ /no-wrap|invisible/
not $data->{"id"} or $data->{"id"} ne "formlayout"
$data->{'class'} && $data->{'class'} =~ /no-wrap|invisible/
MC/DC0%0/4
!$data->{"id"} || $data->{"id"} ne "formlayout" and not $data->{"class"} && $data->{"class"} =~ /no-wrap|invisible/
not $data->{"id"}
$data->{"id"} ne "formlayout"
$data->{'class'}
$data->{'class'} =~ /no-wrap|invisible/
Truth table14%1/7
not(A) or B and not(C && D)
A= not $data->{"id"}B= $data->{"id"} ne "formlayout"C= $data->{'class'}D= $data->{'class'} =~ /no-wrap|invisible/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | (not $data->{'id'} or $data->{'id'} ne 'formlayout') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | and (not $data->{'class'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | or $data->{'class'} !~ /no-wrap|invisible/)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 18 | $fieldset_html = $self->_wrap_fieldset($fieldset_html); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 18 | return ($fieldset_group, $fieldset_html); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # Usage : generate the form content for a fieldset foreword thing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # Purpose : check and parse the parameters and generate the form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # properly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # Returns : a piece of form HTML code for a fieldset foreword | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # Parameters : input_field, stacked | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # Comments : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # See Also : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | sub _build_fieldset_foreword { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 18 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_fieldset_foreword: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 18 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # fieldset legend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 18 | my $legend = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 18 | ▶ | if (defined $data->{'legend'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | $legend = qq{<legend>$data->{legend}</legend>}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | undef $data->{'legend'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # header at the top of the fieldset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 18 | my $header = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 18 | ▶ | if (defined $data->{'header'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | $header = qq{<h2>$data->{header}</h2>}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | undef $data->{'header'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # message at the top of the fieldset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 18 | my $comment = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 18 | ▶ | if (defined $data->{'comment'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | $comment = qq{<div class="$self->{classes}{comment}"><p>$data->{comment}</p></div>}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 1 | undef $data->{'comment'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 18 | return $legend . $header . $comment; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # Usage : $self->_wrap_fieldset($fieldset_html) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # Purpose : wrap fieldset html by template | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # Returns : HTML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # Comments : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # See Also : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ##################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | sub _wrap_fieldset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 18 | ▶ | my ($self, $fieldset_html) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_wrap_fieldset: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 18 | my $fieldset_template = <<EOF; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | <div class="rbox form"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | <div class="rbox-wrap"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | $fieldset_html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | <span class="tl"> </span><span class="tr"> </span><span class="bl"> </span><span class="br"> </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 18 | return $fieldset_template; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | HTML::FormBuilder::FieldSet - FieldSet container used by HTML::FormBuilder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | my $form = HTML::FormBuilder->new(data => {id => 'testform}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | my $fieldset = $form->add_fieldset({id => 'fieldset1'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | $fieldset->add_field({input => {type => 'text', value => 'Join'}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | $form->add_field($fieldset_index, {input => {type => 'text', value => 'Join'}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | =head1 Attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | =head2 fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | The fields included by this fieldset. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | =head1 Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | =head2 build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | my ($fieldset_group, $fieldset_html) = $fieldset->build(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | =head2 add_field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | $fieldset->add_field({input => {type => 'text', value => 'name'}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | append the field into fieldset and return that field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | =head2 add_fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | $fieldset->add_fields({input => {type => 'text', value => 'name'}},{input => {type => 'text', value => 'address'}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | append fields into fieldset and return the number of fields added. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | =head2 data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | Chylli L<mailto:chylli@binary.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | =head1 CONTRIBUTOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | Fayland Lam L<mailto:fayland@binary.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | Tee Shuwn Yuan L<mailto:shuwnyuan@binary.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||