# Button "generate label" on forms

**URL:** <https://speciforum.org/t/button-generate-label-on-forms/786>\
**Category:** Get Help\
**Created:** [September 28, 2022, 7:25am UTC](https://speciforum.org/t/button-generate-label-on-forms/786 "2022-09-28T07:25:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schuchert](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/schuchert/32/1150_2.png) [@Schuchert](https://speciforum.org/u/Schuchert)\
**Post date:** [September 28, 2022, 7:25am UTC](https://speciforum.org/t/button-generate-label-on-forms/786/1 "2022-09-28T07:25:09Z")

</div>

A user wishes to have a button on the Agent form view that creates an address label.  
A similar button exist for the Collection Object form (Generate Label, visible in edit mode only). I tried to insert it on the agent form view but it does not work.  
Is there a way to create such a button in the xml files ?

---

<div class="post-metadata">

**Author:** ![maxpatiiuk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/maxpatiiuk/32/563_2.png) [@maxpatiiuk](https://speciforum.org/u/maxpatiiuk)\
**Post date:** [September 28, 2022, 6:04pm UTC](https://speciforum.org/t/button-generate-label-on-forms/786/2 "2022-09-28T18:04:47Z")

</div>

The same button XML should work on the `Agent` form. Can you share your XML code?

> it does not work

What specifically did not work? Did the button not appear, or was there some error?

Keep in mind also that the button is only clickable when the record is saved (not a new record)

---

<div class="post-metadata">

**Author:** ![Schuchert](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/schuchert/32/1150_2.png) [@Schuchert](https://speciforum.org/u/Schuchert)\
**Post date:** [September 29, 2022, 7:45am UTC](https://speciforum.org/t/button-generate-label-on-forms/786/3 "2022-09-29T07:45:05Z")

</div>

The XML code used is:

The button appears but it does not react, also not in edit mode and having the record saved

---

<div class="post-metadata">

**Author:** ![Schuchert](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/schuchert/32/1150_2.png) [@Schuchert](https://speciforum.org/u/Schuchert)\
**Post date:** [September 29, 2022, 8:10am UTC](https://speciforum.org/t/button-generate-label-on-forms/786/4 "2022-09-29T08:10:01Z")

</div>

the XML code did not go through in my last message

cell type=“command” id=“114” name=“generateLabelBtn” label=“Generate Label” ignore=“true” default=“true” initialize=“visible=false;align=right”/\>

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [September 29, 2022, 12:55pm UTC](https://speciforum.org/t/button-generate-label-on-forms/786/5 "2022-09-29T12:55:21Z")

</div>

Hi @Schuchert,

I used the line of code you sent in your message and it appeared correctly on the form:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/b/bd9efafa8d721f6022c698a4fd767770ff6fe110.png)

Here is the entire XML snippet that I have in my view definition:

```auto
        <viewdef
            type="form"
            name="Agent"
            class="edu.ku.brc.specify.datamodel.Agent"
            gettable="edu.ku.brc.af.ui.forms.DataGetterForObj"
            settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
            <desc><![CDATA[Agent subform for Acessions.]]></desc>

            <columnDef >100px,2px,195px,5px,75px,2px,128px,5px,80px,2px,140px,5px,110px,2px,90px,2px,35px,0px,15px,p:g</columnDef>
            <columnDef os="lnx">115px,2px,200px,5px,85px,2px,140px,5px,90px,2px,149px,5px,110px,2px,95px,2px,35px,0px,15px,p:g</columnDef>
            <columnDef os="mac">130px,2px,215px,5px,85px,2px,160px,5px,105px,2px,164px,5px,190px,2px,95px,2px,48px,0px,15px,p:g</columnDef>
            <columnDef os="exp">p,2px,p:g,5px:g,p,2px,p:g,5px:g,p,2px,p:g,5px:g,p,2px,p:g,2px,p,0px,p,p:g</columnDef>
            <rowDef auto="true" cell="p" sep="2px"/>

            <rows>
                <row>
				<cell type="command" id="114" name="generateLabelBtn" label="Generate Label" ignore="true" default="true" initialize="visible=false;align=right"/>
				</row>
				<row>
                    <cell type="label" labelfor="0"/>
                    <cell type="field" id="0" name="agentType" uitype="combobox" ignore="true"/>
                    <cell type="label" labelfor="1"/>
                    <cell type="field" id="1" name="title" uitype="combobox"/>
                    <cell type="label" labelfor="prefix"/>
                    <cell type="field" id="prefix" name="text1" uitype="text"/>
                    <cell type="label" labelfor="suf"/>
                    <cell type="field" id="suf" name="suffix" uitype="text"/>
                </row>
                <row>
                    <cell type="label" labelfor="3"/>
                    <cell type="field" id="3" name="lastName" uitype="text" colspan="5" isrequired="true"/>
                    <cell type="label" labelfor="5"/>
                    <cell type="field" id="5" name="firstName" uitype="text"/>
                    <cell type="label" labelfor="middleName"/>
                    <cell type="field" id="middleName" name="text2" uitype="text"/>
                </row>
                <row>
                    <cell type="label" labelfor="firstInitial"/>
                    <cell type="field" id="firstInitial" name="text4" uitype="text"/>
                    <cell type="label" labelfor="4"/>
                    <cell type="field" id="4" name="middleInitial" uitype="text"/>
                    <cell type="label" labelfor="role"/>
                    <cell type="field" id="role" name="text3" uitype="combobox" readonly="true"/>
                    <!--<cell type="label" labelfor="unstandardizedString"/>
                    <cell type="field" id="unstandardizedString" name="text5" uitype="text"/>-->
                </row>
                <row>
                    <cell type="label" labelfor="7"/>
                    <cell type="field" id="7" name="email" uitype="text" colspan="9"/>
                    <cell type="field" id="mailto" name="this" uitype="plugin" initialize="name=WebLinkButton;weblink=MailTo;icon=EMail;watch=7"/>
                </row>
                <row>
                    <cell type="label" labelfor="remarks"/>
                    <cell type="field" id="remarks" name="remarks" uitype="text" colspan="9"/>
                </row>
                      <row>
                    <cell type="subview" viewname="Address" id="9" name="addresses" colspan="19"/>
                </row>
                <row>
                    <cell type="subview" viewname="GroupPersons" id="31" name="groups" defaulttype="table" colspan="19" /> <!-- initialize="addsearch=true"/> -->
                </row>
                <row>
                    <cell type="subview" viewname="AgentVariant" id="10" name="variants" colspan="19"/>
                </row>
                <row>
                    <cell type="separator" label="Attachments" colspan="19"/>
                </row>
                <row>
                    <cell type="subview" viewname="AgentSpecialty" id="50" name="agentSpecialties" colspan="19" rows="3"/>
                </row>
                <row>
                    <cell type="subview" id="agentAttachments" viewname="ObjectAttachment" name="agentAttachments" initialize="btn=true;icon=AgentAttachment"/>
                </row>
                <row>
                    <cell type="label" labelfor="11" />
                    <cell type="field" id="11" name="guid" uitype="text" colspan="5" readonly="true"/>
                </row>
              </rows>
        </viewdef>

```

It allows me to generate a report or label when clicked for the Agent table.

Can you send a screenshot of the issue and provide information about which version of Specify you are running? You can provide your full form definition and I can take a look as well.

---

<div class="post-metadata">

**Author:** ![Schuchert](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/schuchert/32/1150_2.png) [@Schuchert](https://speciforum.org/u/Schuchert)\
**Post date:** [September 30, 2022, 8:12am UTC](https://speciforum.org/t/button-generate-label-on-forms/786/6 "2022-09-30T08:12:46Z")

</div>

the viewdef did not work in my environment (Specify 6.8.01).  
I thus prefer to wait with this button until we are also on Specify 7.  
For the moment we will use the Reports module to create adress labels  
Many thanks nevertheless and kind regards,  
Peter

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/1/18a843c97bc32b40e8ad0e035755bc88ffaacaf7.svg) [@system](https://speciforum.org/u/system)\
**Post date:** [July 18, 2025, 4:47pm UTC](https://speciforum.org/t/button-generate-label-on-forms/786/7 "2025-07-18T16:47:42Z")

</div>

Closed on July 18, 2025, 4:47pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
