5,855
edits
Changes
m
If a form you require is not Form definitions are stored in XML files. These are located in the list of supported Form directory beneath your [[Addon:Form DefinitionsGramps_{{man version}}_Wiki_Manual_-_User_Directory|definitionsuser plugins directory]] then you can write your own. The file called <code>form_xx.xml</code>(where ''xx'' is a country code), is provided in the download, and contains some common definitions. Additional files called <code>custom.xml</code> and <code>test.xml</code> will also be searched.
Form Although you can add your definitions are stored in XML files. These are located in to the Form directory beneath your [[Gramps_{{Version manual}}_Wiki_Manual_pre-_User_Directory|user plugins directory]]. The file called defined entries in <code>form_xx.xml</code>(where ''xx'' , it is recommended you create a country code), is provided in the download, and contains some common definitions. Additional files separate file called <code>custom.xml</code> and or <code>test.xml</code> will also be searchedfor this purpose.
Although you can add your definitions to the pre-defined entries in <code>form_xx.xml</code>, it is recommended you create a separate file called <code>custom.xml</code> or <code>test.xml</code> for this purpose.
no edit summary
{{man note|Form Creation: Intended for users who wish to create custom Form definitions for the [[Addon:Forms Gramplet|Forms Gramplet]] addon.|That can be shared with other members of the Gramps community.}}
{{man warn|Please note in Gramps 4.2.x or newer the [[Addon:Forms_Gramplet|Forms Gramplet]] addon replaced the older [[Census_Addons|Census Addon]].}}
Information on creating a new form for the [[Addon:Forms Gramplet|Forms Gramplet]] addon.
=== Writing your own form definitions ===
{{man note|Note: For the form to work|Make sure that your definition file is saved using UTF-8 encoding.}}
[[File:Form Editor.png|right|thumb|600px|example form]]
If a form you require is not in the list of supported [[Addon:Form Definitions|definitions]] then you can write your own.
====Definition file structure====
{{man note|Note: The underscore is important in the <code><_attribute></code> & <code><_longname></code> elements.|As the underscore indicates that the text should be translated by translators.}}
=====heading elements=====
Each form element may optionally contain <code>heading</code> elements. Heading elements describe information that is recorded once for each form.
<_attribute>City or Borough</_attribute>
</heading>
====Tips on debugging your custom form definitions====
After creating or updating a form (in <code>custom.xml</code> or <code>test.xml</code>) to make sure your Form is correctly formatted use a text editor that includes an XML mode and syntax check, (like <code>NotePad++</code> and install the "<code>XML Tools</code>" plugin), then the editor will be able to tell you if your Form's XML code is formatted correctly.
If the XML form check worked then start Gramps to test it and if the form. If {{man label|Forms Gramplet}}'s {{man button|New}} and {{man button|Edit}} buttons don't appear in the {{man label|Forms Gramplet}} then there is a good chance that an XML syntax (or other) error has occurred. The {{man label|Forms Gramplet}} will not tell you where the error is, but luckily you may get a message in <code>grampsXX.log</code> (in the root of gramps user directory) that may look like:
<nowiki>
Traceback (most recent call last):
File "C:\Program Files\GrampsAIO64-56.10.25\gramps\gen\plug\_manager.py", line 252, in load_plugin
_module = self.import_plugin(pdata)
...
File "C:\Users\<~username>\AppData\Roaming\gramps\gramps51gramps60\plugins\Form\form.py", line 114, in __load_definitions
dom = xml.dom.minidom.parse(definition_file)
File "AIO/xml/dom/minidom.py", line 1958, in parse
25285: ERROR: grampsapp.py: line 157: Unhandled exception
...
File "C:\Users\<~username>\AppData\Roaming\gramps\gramps51gramps60\plugins\Form\editform.py", line 995, in __init__
title1, title2 = title.split('/')
ValueError: not enough values to unpack (expected 2, got 1)</nowiki>
For the example error above, the title was fine, the Forms Gramplet was reporting that one of the entries in the custom form was incorrectly typed and should be exactly like the supported [[Addon:Forms_Gramplet#Writing_your_own_form_definitionsforms_element|form elements]].
=== Submitting your form definitions ===
See existing [[Addon:Form Definitions]] for a current list.
==Issues==
See issues attached to the ''[https://gramps-project.org/bugs/tag_view_page.php?tag_id=257 Forms]'' tag.
==See also==