[Rt-commit] rt branch, 4.2/selectcustomfieldvalue-default, created. rt-4.1.6-1-gde380bd
Alex Vandiver
alexmv at bestpractical.com
Tue Jan 15 00:55:36 EST 2013
The branch, 4.2/selectcustomfieldvalue-default has been created
at de380bd4071147501b8d19e11414dc4920016ffa (commit)
- Log -----------------------------------------------------------------
commit de380bd4071147501b8d19e11414dc4920016ffa
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Jan 15 00:55:32 2013 -0500
Allow SelectCustomFieldValue to take a default value
diff --git a/share/html/Elements/SelectCustomFieldValue b/share/html/Elements/SelectCustomFieldValue
index 5c2e2ce..6a3078c 100644
--- a/share/html/Elements/SelectCustomFieldValue
+++ b/share/html/Elements/SelectCustomFieldValue
@@ -45,21 +45,23 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-% $m->callback( Name => $Name, CustomField => $CustomField );
+% $m->callback( Name => $Name, CustomField => $CustomField, Default => \$Default );
+% $Default = "" unless defined $Default;
% if ($CustomField->Type =~ /Select/i) {
% my $values = $CustomField->Values;
<select name="<%$Name%>">
<option value="" selected="selected">-</option>
<option value="NULL"><&|/l&>(no value)</&></option>
% while (my $value = $values->Next) {
-<option value="<%$value->Name%>"><%$value->Name%></option>
+<option value="<%$value->Name%>"<% ($value->Name eq $Default) ? q[ selected="selected"] : ''%>><%$value->Name%></option>
% }
</select>
% }
% else {
-<input name="<%$Name%>" size="20" />
+<input name="<%$Name%>" size="20" value="<% $Default %>" />
% }
<%args>
$Name => undef
-$CustomField =>undef
+$CustomField => undef
+$Default => undef
</%args>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list