+% } else { # alternate format
+
+ <INPUT TYPE = "hidden"
+ NAME = "<%$pre%>address2"
+ VALUE = "<% $object->get($pre.'address2') |h %>"
+ >
+
+<TR>
+ <<%$th%> ALIGN="right">Unit type and #</<%$th%>>
+ <TD COLSPAN=7>
+
+% my $location_type = scalar($cgi->param('location_type'))
+% || $object->get($pre.'location_type');
+% #my $location_number = scalar($cgi->param('location_number'))
+% # || $object->get($pre.'location_number');
+%
+% if ( $object->get($pre.'address2') && ! $location_type ) {
+% }
+%
+% if ( 1 ) { #ikano, switch on via config
+% tie my %location_types, 'Tie::IxHash',
+% FS::part_export::ikano->location_types;
+ <% include('/elements/select.html',
+ 'cgi' => $cgi,
+ 'field' => 'location_type',
+ 'id' => 'location_type',
+ 'disabled' => $disabled,
+ #'style' => \@style,
+ 'options' => [ keys %location_types ],
+ 'labels' => \%location_types,
+ 'curr_value' => $location_type,
+ 'onchange' => 'location_type_changed',
+ )
+ %>
+ <SCRIPT TYPE="text/javascript">
+ function location_type_changed (what) {
+ if ( what.options[what.selectedIndex].value == '' ) {
+ what.form.location_number.disabled = true;
+ what.form.location_number.style.backgroundColor = '#dddddd';
+ } else {
+ what.form.location_number.disabled = false;
+ what.form.location_number.style.backgroundColor = '#ffffff';
+ }
+ }
+ </SCRIPT>
+% } else {
+ <INPUT TYPE = "text"
+ NAME = "location_type"
+ ID = "location_type"
+ VALUE = "<% $location_type |h %>"
+ SIZE = "10"
+ <% $disabled %>
+ <% $style %>
+ >
+% }
+
+ <INPUT TYPE="text"
+ NAME = "location_number"
+ ID = "location_number"
+ VALUE = "<% scalar($cgi->param('location_number')) || $object->get($pre.'location_number') |h %>"
+ SIZE = "5"
+ <% $disabled || ($location_type ? '' : 'DISABLED') %>
+ <% $style %>
+ >
+
+% #XXX i don't work so well when the dropdown is changed :/ i probably need to be triggered by "default service address"
+% $alt_err =~ s/(ship_)?address2/'<B>'.encode_entities($object->get($1.'address2')).'<\/B>'/e;
+ <% $alt_err %>
+
+ </TD>
+
+</TR>
+
+% }
+
+