diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index e4b6cc6f4..6eba6f468 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -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 button to Form.pm / HTMLForm.pm (Len Kranendonk) 6.2.7 - Expanded upon the help for URL extensions. diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm index a5e896910..0ef777d8c 100644 --- a/lib/WebGUI/Form.pm +++ b/lib/WebGUI/Form.pm @@ -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 '{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 '{extras}.'>'; + return '{extras}.'>'; + } #------------------------------------------------------------------- diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index 2daac7a1d..fccf27e19 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -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 '