Button "generate label" on forms

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 ?

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)

The XML code used is:

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

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”/>

Hi @Schuchert,

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

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

        <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.

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