Skip to content

Form Basics

redrinkwater edited this page Jun 23, 2021 · 13 revisions

Introduction

The forms for data entry are managed through one main XML file - botany.views.xml. There may also be form layouts in common.views.xml, in general, if it is being edited for use at RBGE it has been moved to botany.views.xml.

The xml files have two main sections:

  • Views
  • ViewDefs

The Views section is rarely edited. In part this is used to control whether the default view is a table or a grid. The ViewDefs section is where the layout of the form is done.

The xml document contains the layouts for all the forms we have worked on at RBGE and is quite difficult to navigate. I have tried to improve this by ordering all the forms alphabetically, grouping related forms where needed (e.g. Gift, GiftAgent, GiftPreparation). I have added a list at the top of the file to show what is included in it. I have also added headings to make it possible to search for a particular part using SECTION:[form].

Commented out code is indicated by <!-- content -->

Form structure

Heading

A section of a form is bracketed by

<viewdef 
            type="form"
            name="AccessionAgent"
            class="edu.ku.brc.specify.datamodel.AccessionAgent"
            gettable="edu.ku.brc.af.ui.forms.DataGetterForObj"
            settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
            <desc><![CDATA[The Accession form.]]></desc>
            <enableRules/> 
...

</viewdef>
  • type:'form' 'formtable'
  • name:name of the table in the Specify schema
  • class: not edited
  • gettable: not edited
  • settable: not edited
  • <desc>: name of the form, not sure if this is used outside of here
  • <enableRules>: some forms have information filled in from the base form. Generally not edited

Column Layout

The next section lays out the spacing of the sections of the form:

            <columnDef>105px,2px,453px,5px,110px,2px,155px,p:g</columnDef>
            <columnDef os="lnx">135px,2px,520px,5px,98px,2px,155px,p:g</columnDef>
            <columnDef os="mac">130px,2px,551px,5px,153px,2px,189px,p:g</columnDef>
            <columnDef os="exp">p,2px,p,5px,85px,2px,p:g(2),p:g</columnDef>
            <rowDef auto="true" cell="p" sep="2px"/>

The first for rows are for layouts for different Operating Systems:

  • Windows
  • Linux
  • Mac
  • Elastic

All follow the same format.

2 data entry fields:

Label Space Field Space Label Space Label
105px 2px 453px 5px 110px 2px 155px p:g

3 data entry fields:

Label Space Field Space Label Space Field Space Label Space Field p:g
100px 2px 125px 5px 75px 2px 128px 5px 80px 2px 140px 35px 0px p:g

If any adjustments need to be made to the size of either the label or field length, the total number of pixels has to remain the same. Often there are some 'spare' pixels at the end of a row (e.g. 35px in the 3 field example). This can be used to add/remove pixels from other sections.

Adjustments should be made to all OS options. In general try and keep the proportions of each section the same.

Certain field types require a minimum length of field e.g. Query Combo Boxes, so this needs to be taken into consideration when changing field sizes.

Rows

The rows of a form are defined in the section betwen <rows>...</rows>

The content for each individual row is between <row>...</row>. The total number of fields in a row can't be greater than the number of columns defined at the top of each form section.

            <rows>
                <row>
                    <cell type="label" labelfor="1"/>
                    <cell type="field" id="1" name="agent" uitype="querycbx" initialize="name=Agent;title=Agent"/>
                    <cell type="label" labelfor="2"/>
                    <cell type="field" id="2" name="role" uitype="combobox"/>
                </row>
                <row>
                    <cell type="label" labelfor="3"/>
                    <cell type="field" id="3" name="remarks" uitype="textareabrief" rows="2" colspan="6"/>
                </row>
            </rows>
Clone this wiki locally