package WebGUI::Form; #------------------------------------------------------------------- # WebGUI is Copyright 2001 Plain Black Software. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use strict qw(vars subs); use WebGUI::International; use WebGUI::Session; #------------------------------------------------------------------- sub _fixQuotes { my $value = shift; $value =~ s/\"/\"\;/g; return $value; } #------------------------------------------------------------------- sub checkbox { my ($output, $name, $value, $checked); ($name, $value, $checked) = @_; if ($checked) { $checked = ' checked'; } $output = ''; return $output; } #------------------------------------------------------------------- sub file { my ($output, $name); ($name) = @_; $output = ''; return $output; } #------------------------------------------------------------------- sub hidden { my ($output, $name, $value); ($name, $value) = @_; $value = _fixQuotes($value); $output = ''; return $output; } #------------------------------------------------------------------- sub password { my ($output, $name, $size, $maxLength, $value); $name = shift; $size = shift; if ($size eq "") { $size = 15; } $maxLength = shift; if ($maxLength ne "") { $maxLength = ' maxlength="'.$maxLength.'"'; } $value = shift; $output = ''; return $output; } #------------------------------------------------------------------- sub radio { my ($output, $name, $value, $checked); ($name, $value, $checked) = @_; if ($checked) { $checked = ' checked'; } $output = ''; return $output; } #------------------------------------------------------------------- # eg: selectList(name, valueListHashref, selectedArrayref, size, multipleSelection, onChange) sub selectList { my ($output, $valueList, $key, $item, $name, $selected, $size, $multiple, $onChange); ($name, $valueList, $selected, $size, $multiple, $onChange) = @_; if ($size > 1) { $size = ' size="'.$size.'"'; } if ($multiple > 0) { $multiple = ' multiple="1"'; } if ($onChange ne "") { $onChange = ' onChange="'.$onChange.'"'; } $output = ''; } $value = _fixQuotes($value); $output = ''.$assistance; return $output; } #------------------------------------------------------------------- sub textArea { my ($output, $name, $value, $cols, $rows, $htmlEdit, $wrap); ($name, $value, $cols, $rows, $htmlEdit, $wrap) = @_; if ($cols eq "") { $cols = 50; } if ($rows eq "") { $rows = 5; } if ($htmlEdit > 0) { $output .= ''; $output .= '
'; } if ($wrap eq "") { $wrap = "virtual"; } $output .= ''; return $output; } 1;