Guest
24 Feb 2014 08:32

Let's say we wanted to build a family tree, starting with the children. This is what I would like to do:

Allow the user to input the child's name in the first form.

After that, the user can enter his/her parents or other siblings.

So after entering the child's name, the next form should contain a field that has the child's name pre-filled in a text box on the next form. (Or the child's name can be stored in a hidden field.) This way, we know that the next person inserted is related to the child.

How would I create a form that is pre-filled with a default (but unchangeable) value? Would the value be passed through the URL or some other way?

Thanks.

Last Modified: 02 Mar 2014


Sergey
Total posts: 13,748
24 Feb 2014 08:49

I think best way to create family tree starting from roots. First you enter oldest person you remember in a tree. And then you add children indicating only single parent for every child.

You do not need few types. You refer to the same type. the same type "Person" nas Child and parent fields and refer to the same type. This way every Person will show you who is parent and who are children all within single type.

And all you need now as a small custom one page extension that will use Cobalt DB to draw tree like view. That will not cost much.


Guest
24 Feb 2014 08:55

Understood. In this particular case, the client wants to be able to input the children first, and then enter the parents next. In the actual database, we will only be concerned with children and parents/guardians. Once the user completes the child's name (and other fields), the user should be redirected to enter at least one family member (typically a parent). So while entering the parent, the child's name (or unique ID number anyway) needs to be pre-filled on the form and unchangeable.

I hope that made sense.


Sergey
Total posts: 13,748
24 Feb 2014 09:04

the client wants to be able to input the children first, and then enter the parents next

In most of the cases, when by the time you add Person there are not yet any children saved.

But anyway, why you use SQL source for that not relate fields?


Guest
24 Feb 2014 10:11

Hmmm. Just to be certain, are you referring to the Relation Field Type? Or do you mean that I should simply create a List autocomplete field labeled "Related to"?


Sergey
Total posts: 13,748
24 Feb 2014 23:08

yes, that is exactly what I do refer to.

Powered by Cobalt