[ic] table_editor ui_te_check not showing label
Bill Carr
bill at worldwideimpact.com
Wed Oct 4 15:51:10 EDT 2006
On Oct 4, 2006, at 12:54 PM, Mike Heins wrote:
> Quoting Bill Carr (bill at bottlenose-wine.com):
>> Hello ICers,
>> When I set CGI->ui_te_check:field and ui_te_label:field the label is
>> not showing for the given field from the table_editor tag. If I
>> remove ui_te_check:field the label shows. Below is a little chunk of
>> my stuff.
>>
>> [perl]
>> for(@fields) {
>> next if
>> $Tag->data('mv_metadata','code',qq{custview::userdb::$_});
>> my $meta = Vend::Table::Editor::meta_record(qq{userdb::$_});
>> $CGI->{'ui_te_label:fname'} = $meta->{label} ||
>> 'First Name';
>> $CGI->{'ui_te_check:fname'} = 'required Please enter your
>> First Name.';
>> }
>> [/perl]
>>
>> [table-editor
>> cgi=1
>> table=userdb
>> mv_data_fields=`$CGI->{mv_data_fields}`
>> incomplete_form_ok=1
>> defaults=1
>> default_ref=`$Values`
>> ]{:REST}[/table-editor]
>> The above does not show a label for 'fname' field.
>>
>>
>> It is somewhat of a hack. What I ultimately would like to do is
>> specify default options in the table_editor tag as follows
>>
>> [table-editor
>> label.fname = 'First Name'
>> check.fname = 'required Please enter your First Name.'
>> ]
>>
>> And then be able to override those values in mv_metadata. The reason
>> is the above table_editor appears on a page that is shared by many
>> catalogs. It would be ready to go with appropriate defaults that
>> could be easily overridden using the mv_metadata facility on a per
>> catalog basis.
>>
>> Is there some kind of default_metadata_from_options switch for the
>> table_editor?
>
> No. I would think it might be possible, but someone would have to
> look at it and do it. That won't be me anytime soon, too busy.
Here's a stab at it. The option name is quite a mouthful but I could
not come up with anything better.
ui_meta_overrides_options - If set settings in mv_metadata will
override settings set directly in the table_editor tag.
--- /root/interchange-5.4.1/lib/Vend/Table/Editor.pm 2005-11-09
04:04:18.000000000 -0500
+++ /usr/lib/interchange/Vend/Table/Editor.pm 2006-10-04
15:42:08.000000000 -0400
@@ -725,7 +725,6 @@
sub display {
my ($table,$column,$key,$opt) = @_;
-
if( ref($opt) ne 'HASH' ) {
$opt = get_option_hash($opt);
}
@@ -847,7 +846,11 @@
for(@override) {
delete $record->{$_} if ! length
($record->{$_});
next unless defined $opt->{$_};
- $record->{$_} = $opt->{$_};
+ if ($opt->{ui_meta_overrides_options}) {
+ $record->{$_} ||= $opt->{$_};
+ } else {
+ $record->{$_} = $opt->{$_};
+ }
}
}
@@ -3981,6 +3984,7 @@
type => $widget->{$c},
ui_no_meta_display => $opt->{ui_no_meta_display},
width => $width->{$c},
+
ui_meta_overrides_options => $opt->{ui_meta_overrides_options},
});
#::logDebug("finished display of col=$c");
my $update_ctl;
Bill Carr
Bottlenose - Wine & Spirits eBusiness Specialists
(877) 857-6700
More information about the interchange-users
mailing list