!.
%                 ( $def->{'label'} || $field ).
%                 " ";
%
%        $html .= qq! ';
%
%        $flag = '' if $def->{type} eq 'disabled';
%
%        $html .= qq!!;
%
%        if ( $def->{type} eq 'disabled' ) {
%        
%          $html .= 'No default';
%
%        } else {
%
%          $html .= qq!!;
%
%          foreach my $f ( keys %flag ) {
%
%            # need to template-ize more httemplate/edit/svc_* first
%            next if $f eq 'M' and $layer !~ /^svc_(broadband|external|phone|dish)$/;
%
%            #here is where the SUB from above is called, to skip some choices
%            next if $flag{$f}->{condition}
%                 && &{ $flag{$f}->{condition} }( $def, $layer, $field );
%
%            $html .= qq!'. $flag{$f}->{desc};
%
%          }
%
%          $html .= '  ';
%
%          $html .= join("\n",
%            '',
%          );
%
%        }
%
%        $html .= qq! !;
%
%        my $disabled = $flag ? ''
%                             : 'DISABLED STYLE="background-color: #dddddd"';
%        my $nodisplay = ' STYLE="display:none"';
%
%        if ( !$def->{type} || $def->{type} eq 'text' ) {
%
%          my $is_inv = ( $flag =~ /^[MA]$/ );
%
%          $html .=
%            qq! ';
%
%          $html .= include('/elements/select-table.html',
%                             'element_name' => "${layer}__${field}_classnum",
%                             'element_etc'  => ( $is_inv
%                                                   ? $disabled
%                                                   : $nodisplay
%                                               ),
%                             'table'        => 'inventory_class',
%                             'name_col'     => 'classname',
%                             'value'        => $value,
%                             'empty_label'  => 'Select inventory class',
%                          );
%
%        } elsif ( $def->{type} eq 'checkbox' ) {
%
%          $html .= include('/elements/checkbox.html',
%                             'field'      => $layer.'__'.$field,
%                             'curr_value' => $value,
%                             'value'      => 'Y',
%                          );
%
%        } elsif ( $def->{type} eq 'select' ) {
%
%          $html .= qq!{select_table} ) {
%            foreach my $record ( qsearch( $def->{select_table}, {} ) ) {
%              my $rvalue = $record->getfield($def->{select_key});
%              my $select_label = $def->{select_label};
%              $html .= qq!' : '>' ).
%                  $record->$select_label(). ' ';
%            } #next $record
%          } elsif ( $def->{select_list} ) {
%            foreach my $item ( @{$def->{select_list}} ) {
%              $html .= qq!' : '>' ).
%                    $item. ' ';
%            } #next $item
%          } elsif ( $def->{select_hash} ) {
%            if ( ref($def->{select_hash}) eq 'ARRAY' ) {
%              tie my %hash, 'Tie::IxHash', @{ $def->{select_hash} };
%              $def->{select_hash} = \%hash;
%            }
%            foreach my $key ( keys %{$def->{select_hash}} ) {
%              $html .= qq!' : '>' ).
%                    $def->{select_hash}{$key}. ' ';
%            } #next $key
%          } #endif
%          $html .= ' ';
%
%        } elsif ( $def->{type} eq 'textarea' ) {
%
%          $html .=
%            qq!';
%
%        } elsif ( $def->{type} =~ /select-(.*?).html/ ) {
%
%          $html .= include("/elements/".$def->{type},
%                             'curr_value'   => $value,
%                             'element_name' => "${layer}__${field}",
%                             'element_etc'  => $disabled,
%                             'multiple'     => ($def->{multiple} ||
%                                                $flag eq 'S'),
%                                 # allow the table def to force 'multiple'
%                          );
%
%        } elsif ( $def->{type} eq 'communigate_pro-accessmodes' ) {
%
%          $html .= include('/elements/communigate_pro-accessmodes.html',
%                             'element_name_prefix' => "${layer}__${field}_",
%                             'curr_value'          => $value,
%                             #doesn't work#'element_etc'  => $disabled,
%                          );
%
%        } elsif ( $def->{type} eq 'select-hardware' ) {
%
%          $html .= qq! !;
%          $html .= include('/elements/select-hardware_class.html',
%                             'curr_value'    => $value,
%                             'element_name'  => "${layer}__${field}_classnum",
%                             'element_etc'   => $flag ne 'H' && $nodisplay,
%                             'empty_label'   => 'Select hardware class',
%                          );
%
%        } elsif ( $def->{type} eq 'disabled' ) {
%
%          $html .=
%            qq! !;
%
%        } else {
%
%          $html .= 'unknown type '. $def->{type};
%
%        }
%
%        $html .= "   \n";
%        $def_info = "($def_info)" if $def_info;
%        $html .=
%          qq!