# File ValidForm_dyntable.rb, line 19
        def to_html(withValidation=true,indentLevel=0)
                tabs = "\t"*indentLevel
                tabs2 = tabs + "\t"
                col1 = (@fields.length/2).floor
                col2 = @fields.length-col1
                @attributes[:class] = 'dynamic'
                @attributes[:class] += ' growable' if @growable
                @attributes[:class] += ' deleteable' if @deletable
                @attributes[:hidedeletedrows] = !!@hidedeletedrows
                @attributes[:autoincrement] = !!@autoincrement
                
                html = tabs + %|<table#{hashes_toattributes(@attributes)}><thead><tr>\n|
                allFields = fields
                allFields.each{ |f|
                        html<< tabs2 + %|<th id="#{f.id}"#{' class="last"' if f==allFields.last}>#{f.label}</th>\n|
                }
                html<< tabs + %|</tr></thead><tfoot><tr>\n|
                html<< tabs2+ %|<td colspan="#{col1}" class="reset"><button type="button" onclick="DynTable_AddRow(this)">New</button></td>|
                html<<        %|<td colspan="#{col2}" class="save"><button type="submit">Save Changes</button></td>\n|
                html<< tabs + %|</tr></tfoot><tbody>\n|
                @pgresult.result.each_index{ |i|
                        row_num = i.to_s
                        row_id = @pgresult.getvalue_byname(i,'id')
                        html<< emitrow(i.to_s, row_id)
                }
                html<< tabs2 + emitrow('_xx_')
                html<< tabs + %|</tbody></table>\n|
        end