Added <input type="button"> button
This commit is contained in:
parent
c01f16a27f
commit
ab6e7c67ef
3 changed files with 92 additions and 3 deletions
|
|
@ -10,7 +10,8 @@
|
|||
- Lots of GUID changes in Perl and SQL code, including:
|
||||
bugfix [1053187]
|
||||
- Bugfix [ 1055396 ] Template switching issue (Len Kranendonk)
|
||||
|
||||
- WebGUI Operations are now dynamically loaded (Len Kranendonk)
|
||||
- Added <input type="button"> button to Form.pm / HTMLForm.pm (Len Kranendonk)
|
||||
|
||||
6.2.7
|
||||
- Expanded upon the help for URL extensions.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ Base forms package. Eliminates some of the normal code work that goes along with
|
|||
|
||||
use WebGUI::Form;
|
||||
|
||||
$html = WebGUI::Form::button({value=>"Click me!", extras=>qq|onclick="alert('Aaaaggggghhh!!!')"|});
|
||||
$html = WebGUI::Form::checkbox({name=>"whichOne", value=>"red"});
|
||||
$html = WebGUI::Form::checkList({name=>"dayOfWeek", options=>\%days});
|
||||
$html = WebGUI::Form::combo({name=>"fruit",options=>\%fruit});
|
||||
|
|
@ -109,6 +110,31 @@ sub _fixTags {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 button ( hashRef )
|
||||
|
||||
Returns a button. Use it in combination with scripting code to make the button perform an action.
|
||||
|
||||
=head3 value
|
||||
|
||||
The button text for this submit button. Defaults to "save".
|
||||
|
||||
=head3 extras
|
||||
|
||||
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
|
||||
|
||||
'onClick="alert(\'You've just pushed me !\')"'
|
||||
|
||||
=cut
|
||||
|
||||
sub button {
|
||||
my ($label, $extras, $subtext, $class, $output, $name, $value);
|
||||
$value = $_[0]->{value} || WebGUI::International::get(62);
|
||||
$value = _fixQuotes($value);
|
||||
return '<input type="button" value="'.$value.'" '.$_[0]->{extras}.'>';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 checkbox ( hashRef )
|
||||
|
|
@ -1327,7 +1353,8 @@ sub submit {
|
|||
$value = $_[0]->{value} || WebGUI::International::get(62);
|
||||
$value = _fixQuotes($value);
|
||||
$wait = WebGUI::International::get(452);
|
||||
return '<input type="submit" value="'.$value.'" onClick="this.value=\''.$wait.'\'" '.$_[0]->{extras}.'>';
|
||||
return '<input type="submit" value="'.$value.'" onClick="this.value=\''.$wait.'\'" '.$_[0]->{extras}.'>';
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ Package that makes HTML forms typed data and significantly reduces the code need
|
|||
use WebGUI::HTMLForm;
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
|
||||
$f->button(
|
||||
-value=>"Click me!",
|
||||
-extras=>qq|onClick="alert('Aaaaaaaggggghh!!!!')"|
|
||||
);
|
||||
$f->checkbox(
|
||||
-name=>"whichOne",
|
||||
-label=>"Is red your favorite?",
|
||||
|
|
@ -176,6 +180,8 @@ $f->dynamicField(text,
|
|||
-label=>"Office Zip Code"
|
||||
);
|
||||
|
||||
$f->trClass("class"); # Sets a Table Row class
|
||||
|
||||
$f->print;
|
||||
$f->printRowsOnly;
|
||||
|
||||
|
|
@ -197,7 +203,9 @@ sub _subtext {
|
|||
#-------------------------------------------------------------------
|
||||
sub _tableFormRow {
|
||||
unless ($_[0]->{_noTable}) {
|
||||
return '<tr><td class="formDescription" valign="top">'.$_[1].'</td><td class="tableData">'.$_[2]."</td></tr>\n";
|
||||
my $class = $_[0]->{_class};
|
||||
$class = qq| class="$class" | if($class);
|
||||
return '<tr'.$class.'><td class="formDescription" valign="top">'.$_[1].'</td><td class="tableData">'.$_[2]."</td></tr>\n";
|
||||
} else {
|
||||
return $_[2];
|
||||
}
|
||||
|
|
@ -214,6 +222,45 @@ sub _uiLevelChecksOut {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 button ( value [ label, extras, subtext ] )
|
||||
|
||||
Adds a button row to this form. Use it in combination with scripting code to make the button perform an action.
|
||||
|
||||
=head3 value
|
||||
|
||||
The button text for this button. Defaults to "save".
|
||||
|
||||
=head3 label
|
||||
|
||||
The left column label for this form row.
|
||||
|
||||
=head3 extras
|
||||
|
||||
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
|
||||
|
||||
'onClick="alert(\'Hello there!\')"'
|
||||
|
||||
=head3 subtext
|
||||
|
||||
Extra text to describe this form element or to provide special instructions.
|
||||
|
||||
=cut
|
||||
|
||||
sub button {
|
||||
my ($output);
|
||||
my ($self, @p) = @_;
|
||||
my ($value, $label, $extras, $subtext) = rearrange([qw(value label extras subtext)], @p);
|
||||
$output = WebGUI::Form::button({
|
||||
"value"=>$value,
|
||||
"extras"=>$extras
|
||||
});
|
||||
$output .= _subtext($subtext);
|
||||
$output = $self->_tableFormRow($label,$output);
|
||||
$self->{_data} .= $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 checkbox ( name [ label, checked, subtext, value, extras, uiLevel ] )
|
||||
|
||||
Adds a checkbox row to this form.
|
||||
|
|
@ -2121,6 +2168,20 @@ sub timeField {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trClass ( )
|
||||
|
||||
Sets a CSS class for the Table Row. By default the class is undefined.
|
||||
|
||||
=cut
|
||||
|
||||
sub trClass {
|
||||
my $self = shift;
|
||||
my $class = shift;
|
||||
$self->{_class} = $class;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 url ( name [ label, value, maxlength, extras, subtext, size, uiLevel ] )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue