Form addon development questions

  1. Is it possible render element for drug&drop? As I see, I can create entity or select it from the list. I would like move all them to the form.

  1. As you can see on the screenshot, I have duplicated titles Godparent 2, but they are different in my xml
        <section role='Godparent' type='person' title='Godparent 1'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Godparent' type='person' title='Godparent 2'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
  1. File “forms.py”:
# Files which may contain form definitions
definition_files = ['form_be.xml', 'form_ca.xml', 'form_dk.xml', 'form_fr.xml',
                    'form_gb.xml', 'form_pl.xml', 'form_us.xml', 'form_ua.xml',
                    'test.xml', 'custom.xml']

Maybe it would be better load all .xml files automatically without manual defining each file? ‘form_ua.xml’ - is my. Something like addons are loading.

  1. Is it possible create 2 or more different events from a Form? For example: Birth and Babtism, or Death or Burial.

  2. Why documentation warns that it is better make custom events’ names. Are there some risks for earlier saved data?

My current draft:

<?xml version="1.0" encoding="UTF-8"?>
<forms>
    <form id='UABirth' type='Birth' title='Ukrainian Birth Metric'>
        <heading>
            <_attribute>Date Registered</_attribute>
        </heading>
        <heading>
            <_attribute>Registrar</_attribute>
        </heading>
        <section role='Primary' type='person' title='Child'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Father' type='person' title='Father'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Mother' type='person' title='Mother'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Godparent' type='person' title='Godparent 1'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Godparent' type='person' title='Godparent 2'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
    </form>
    <form id='UAMarriage' type='Marriage' title='Ukrainian Marriage Metric'>
        <section role='Family' type='family' title='Groom/Bride'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Primary' type='person' title='Groom'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Primary' type='person' title='Bride'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Witness for' type='multi' title='Groom Witnesses'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Witness for' type='multi' title='Bride Witnesses'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
    </form>
    <form id='UADeath' type='Death' title='Ukrainian Death Metric'>
        <heading>
            <_attribute>Date</_attribute>
        </heading>
        <heading>
            <_attribute>Registrar</_attribute>
        </heading>
        <section role='Primary' type='person' title='Deceased'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
        <section role='Primary' type='person' title='Mentioned'>
            <column>
                <_attribute>Name</_attribute>
            </column>
        </section>
    </form>
</forms>
  1. I don’t think that you can drag&drop people or families onto a form. It would make a good enhancement though.

  2. Where you want to enter more than one person in the same role, use type='multi'.

  3. We can add form_ua.xml to the list of definition files. You can then be the maintainer of this file. Then if anyone else submits a form for Ukraine, we can ask you to review and approve it.

  4. No, only one event is created. This is where we need to enhance the functionality to create secondary events.

  5. I don’t agree with the documentation. Use the standard events - Birth, Marriage and Death. You could possibly get an extra event created in some circumstances, but your data will be safe.

Your draft looks good, but you probably don’t want to add the bride and groom directly to the marriage form. This will make them direct participants in the marriage event, and whilst possible, this is generally not recommended.

Got it. I used it for witnesses, but not for godparents. I’ll fix this.

Yeah, it sounds good. But also scripts should check data before they update some personal events. Say, a child already has a calculated date. But we have an exact date in Birth metric. It means script should ovewrite the date. And so on… I think here could be a lot of different checks. As I understand currently the form only creates new events, not updates already existing.

sure. Great!

And also, what about two these improvements? What should I do and who can help?

  1. Add Drag&drop elements for people, places, …
  2. Add ability create multiple events

Looks like Form addon has really big perspectives, it only needs a bit more flexibility

This is just a GUI feature. You would have to define a drag&drop target for a widget, and then write some code to handle an object dropped on it.

I expect that this would be fairly easy to write and I don’t see any reason why it can’t be added.

This is more interesting. We would have to do the following:

  • Enhance the XML definitions to include a type.
  • Add a button to generate the secondary events (and maybe associations).
  • Probably create a dialog for the user to review the changes before they are applied.
  • Write the actual business logic.

Maybe I should take one attribute such as “Residence” or “Occupation” and write some code to give you a framework to follow.

1 Like

Doesn’t the Data Entry Gramplet do a multiple Event creation? (Birth, Death with Source) along with creating the person melding relationship, updating existing People, extracting dates and Places from a compounded field.

Surely, some of that can be adapted.

1 Like

We have a new developer who is interested in implementing some of the changes that you suggest. I’ll leave it to her and offer my support when required.

great! If needed I can also discuss with her, make brain storm, test it and so on…

1 Like

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