Just wanted to hear if anyone here has implemented checkboxes in a
custom field?
seems like this is far more intuitive for multiple select…
Thoughts?
Comments?
pitfalls?
-Joel
Just wanted to hear if anyone here has implemented checkboxes in a
custom field?
seems like this is far more intuitive for multiple select…
Thoughts?
Comments?
pitfalls?
-Joel
This would be easy enough to do. There is a callback in 3.6 that lets
you control what Mason component is used to render a custom field.On 2/29/08, Joel Schuweiler jschuweiler@fonality.com wrote:
Just wanted to hear if anyone here has implemented checkboxes in a
custom field?seems like this is far more intuitive for multiple select…
Thoughts?
Comments?
pitfalls?-Joel
Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.comDiscover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
This would be easy enough to do. There is a callback in 3.6 that lets
you control what Mason component is used to render a custom field.
Can you supply some details, or a pointer to this?
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 jan's very old home page
…You’re visualising the duck taped over my mouth…?
Does this help?
http://lists.bestpractical.com/pipermail/rt-users/2007-November/048774.htmlOn 3/2/08, Jan Grant jan.grant@bristol.ac.uk wrote:
On Sun, 2 Mar 2008, Todd Chapman wrote:
This would be easy enough to do. There is a callback in 3.6 that lets
you control what Mason component is used to render a custom field.Can you supply some details, or a pointer to this?
–
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 jan's very old home page
…You’re visualising the duck taped over my mouth…?
I personally did the following in my EditCustomFieldSelect (in my local dir)
<%method options>
% my $selected;
% my $CFVs = $CustomField->Values;
% my @levels;
% while ($CFVs and my $value = $CFVs->Next )
% {
% if ($CustomField->MaxValues == 0 )
% {
<input type="checkbox" style="border: none;"
value="<%$value->Name%>"
% if ($Values)
% {
<% $Values->HasEntry($value->Name) && ($$SelectedRef
= 1) && ‘CHECKED’ %>
% }
% elsif ($Default)
% {
<% (ref $Default ? (grep {$_ eq $value->Name}
@{$Default}) : ($Default eq $value->Name))
&& ($$SelectedRef = 1) && ‘CHECKED’ %>
% }
><% $value->Name%>
% }
% else
% {
<option value="<%$value->Name%>"
% if ($Values)
% {
<% $Values->HasEntry($value->Name) &&
($$SelectedRef = 1) && ‘SELECTED’ %>
% }
% elsif ($Default)
% {
<% (ref $Default ? (grep {$_ eq $value->Name}
@{$Default}) : ($Default eq $value->Name))
&& ($$SelectedRef = 1) && ‘SELECTED’ %>
% }
><% $value->Name%>
% }
% }
Todd Chapman wrote:
I’m not quite out of the woods yet, as I’ve decided to spend time trying
to figure out rt’s back end, such that checking and un-checking a value
will work. I could whip this up fairly quickly with javascript, but
where is the fun in that?
That said, I would appreciate any help anyone can provide. I’m currently
poking around RT::ObjectCustomFieldValue_Overlay.pm
-Joel
Joel Schuweiler wrote:
Problem solved, final solution:
% my $selected = 0;
% my @category;
% my $id = $NamePrefix . $CustomField->Id;
% my $out = $m->scomp(‘SELF:options’, %ARGS, SelectedRef =>
$selected, CategoryRef => @category, ID => $id);
% if (@category) {
%# XXX - Hide this select from w3m?
<option value="" <% !$selected && ‘SELECTED’
%>><&|/l&>-</&>
% foreach my $cat (@category) {
% my ($depth, $name) = @$cat;
<% ’ ’ x $depth |n
%><%$name%>
% }
% }
%if ($CustomField->MaxValues != 0 )
%{
<select name="<%$id%>-Values" id="<%$id%>-Values"
<% $Multiple && ‘MULTIPLE’ %>>
<option value="" <% !$selected && ‘SELECTED’ %>><&|/l&>(no
value)</&>
% $m->out($out);
%}
%else
%{
% $m->out($out);
%}
<%ARGS>
$Object => undef
$CustomField => undef
$NamePrefix => undef
$Default => undef
$Values => undef
$Multiple => 0
$Rows => undef
</%ARGS>
<%method options>
% my $selected;
% my $CFVs = $CustomField->Values;
% my @levels;
% while ($CFVs and my $value = $CFVs->Next )
% {
% if ($CustomField->MaxValues == 0 )
% {
<input type="checkbox" style="border: none;" name="<%
$ID %>-Values" id="<%$ID%>-Values" value="<%$value->Name%>"
% if ($Values)
% {
<% $Values->HasEntry($value->Name) &&
($$SelectedRef = 1) && ‘CHECKED’ %>
% }
% elsif ($Default)
% {
<% (ref $Default ? (grep {$_ eq $value->Name}
@{$Default}) : ($Default eq $value->Name))
&& ($$SelectedRef = 1) && ‘CHECKED’ %>
% }
><% $value->Name%>
% }
% else
% {
<option value="<%$value->Name%>"
% if ($Values)
% {
<% $Values->HasEntry($value->Name) &&
($$SelectedRef = 1) && ‘SELECTED’ %>
% }
% elsif ($Default)
% {
<% (ref $Default ? (grep {$_ eq
$value->Name} @{$Default}) : ($Default eq $value->Name))
&& ($$SelectedRef = 1) && ‘SELECTED’ %>
% }
><% $value->Name%>
% }
% }
<%args>
$CustomField => undef
$Default => undef
$Values => undef
$SelectedRef => undef
$CategoryRef => undef
$ID => undef
</%args>
</%method>