Understanding formIDs

Hi,

Are formIDs (those that are presented in the formList) supposed to be
used only in the form list, or are they referenced elsewhere? Is there
any tag or attribute in a form itself that is meant to hold a value that
matches the formID that is shown in the node linking to that
form in the form list?

It is not the "id" attribute of the root tag inside the ... or
is it?

I need to tweak ODK Collect a little bit, so that, when it sends a
finished form, it automatically downloads the (updated version of the)
form matching the formID of the form that was used to fill in those
data. Also, so that when you download a form with the same formID of an
existing one, it will overwrite it. So, in order to do that, I need to
store into each form and instance the formID of the original form.
Before I devise my own hack, which is not difficult, I wanted to know if
there is already a standard place where to store that information.

I've searched the XForms standard at w3c, and the OpenRosa APIs at
https://bitbucket.org/javarosa/javarosa/wiki/Home (which seem kind of
incomplete, or am I missing some other documentation resource?) but so
far it looks like the formIDs are only mentioned in the form list
(unless it is the abovementioned id attribute but it seems it's not). Is
that so?

Thanks
m.

The id/formID (and historically xmlns) are used as the unique
identifier for the form. This identifier is important as it allows
Collect, Aggregate, or any other tool know know what submission goes
with what form. To avoid problems the tools will only allow id or an
formId to exist otherwise it becomes a problem which form goes with
this submission.

The confusion comes from over the last 2 years moving the initial
javarosa to something more reasonable. Initially javarosa used the
xmlns as the unique identifier which causes many problems with xml
parsing, so then it moved to 'formID', but people thought the name was
redundant and shorted it to 'id'. Mostly legacy support works but as
you point out the naming has become an issue, because when the code
was written probably affects the name used.

It is not the "id" attribute of the root tag inside the ... or is
it?
Yes they are supposed to be the same. This allows the user to know if
they already have the form in the form list downloaded.

You can check out the FAQ for information about formIds.

··· On Sat, Oct 8, 2011 at 10:11 AM, Matteo Sisti Sette wrote: > Hi, > > Are formIDs (those that are presented in the formList) supposed to be used > only in the form list, or are they referenced elsewhere? Is there any tag or > attribute in a form itself that is meant to hold a value that matches the > formID that is shown in the node linking to that form in the form > list? > > It is not the "id" attribute of the root tag inside the ... or is > it? > > I need to tweak ODK Collect a little bit, so that, when it sends a finished > form, it automatically downloads the (updated version of the) form matching > the formID of the form that was used to fill in those data. Also, so that > when you download a form with the same formID of an existing one, it will > overwrite it. So, in order to do that, I need to store into each form and > instance the formID of the original form. > Before I devise my own hack, which is not difficult, I wanted to know if > there is already a standard place where to store that information. > > I've searched the XForms standard at w3c, and the OpenRosa APIs at > https://bitbucket.org/javarosa/javarosa/wiki/Home (which seem kind of > incomplete, or am I missing some other documentation resource?) but so far > it looks like the formIDs are only mentioned in the form list (unless it is > the abovementioned id attribute but it seems it's not). Is that so? > > Thanks > m. >

Hi,

Thank you for the clarification

··· On 10/08/2011 08:42 PM, W. Brunette wrote: > The id/formID (and historically xmlns) are used as the unique > identifier for the form. This identifier is important as it allows > Collect, Aggregate, or any other tool know know what submission goes > with what form. > >> It is not the "id" attribute of the root tag inside the... or is >> it? > Yes they are supposed to be the same.

Ok. Now, I've had the brilliant idea to use urls as
form IDs, that is, my form ID is the same url from which the form itself
can be downloaded.

And this has lead to ODK Collect crashing all the time. Is it perhaps
because, if the ID is a url, ODK Collect actually tries to download its
contents and interpret it as a form DEFINITION of some sort???? (which
of course is not what it finds, since my id points to the form itself,
not its definition)

If so, what would be the right way to accomplish this?

I mean, I'm using the url of the form as a form ID BECAUSE I need to be
able, given an instance, to know where to get its form from. Is there a
more standard way of doing this?

Thanks
m.

if you use the form id the way the spec describes, the instance will have that form id.

··· On Oct 8, 2011, at 14:28, Matteo Sisti Sette wrote:

Hi,

Thank you for the clarification

On 10/08/2011 08:42 PM, W. Brunette wrote:

The id/formID (and historically xmlns) are used as the unique
identifier for the form. This identifier is important as it allows
Collect, Aggregate, or any other tool know know what submission goes
with what form.

It is not the "id" attribute of the root tag inside the... or is
it?
Yes they are supposed to be the same.

Ok. Now, I've had the brilliant idea to use urls as form IDs, that is, my form ID is the same url from which the form itself can be downloaded.

And this has lead to ODK Collect crashing all the time. Is it perhaps because, if the ID is a url, ODK Collect actually tries to download its contents and interpret it as a form DEFINITION of some sort???? (which of course is not what it finds, since my id points to the form itself, not its definition)

If so, what would be the right way to accomplish this?

I mean, I'm using the url of the form as a form ID BECAUSE I need to be able, given an instance, to know where to get its form from. Is there a more standard way of doing this?

Thanks
m.

I agree with Yaw as the standard way to do this is download the form
once and then once it's present on the phone just keep referencing the
form based on the ID number.

That is why we only hit the formlist. If you need to repeadily
download the form you can hit the formList url as it will give you the
downloadURL (place to download the form from) and you can figure it
out based on the formId, which should be contained in every instance.

https://bitbucket.org/javarosa/javarosa/wiki/FormListAPI

··· On Sat, Oct 8, 2011 at 5:48 PM, Yaw Anokwa wrote: > if you use the form id the way the spec describes, the instance will have that form id. > > On Oct 8, 2011, at 14:28, Matteo Sisti Sette wrote: > >> Hi, >> >> Thank you for the clarification >> >> >> On 10/08/2011 08:42 PM, W. Brunette wrote: >>> The id/formID (and historically xmlns) are used as the unique >>> identifier for the form. This identifier is important as it allows >>> Collect, Aggregate, or any other tool know know what submission goes >>> with what form. >>> >>>> It is not the "id" attribute of the root tag inside the... or is >>>> it? >>> Yes they are supposed to be the same. >> >> Ok. Now, I've had the brilliant idea to use urls as form IDs, that is, my form ID is the same url from which the form itself can be downloaded. >> >> And this has lead to ODK Collect crashing all the time. Is it perhaps because, if the ID is a url, ODK Collect actually tries to download its contents and interpret it as a form DEFINITION of some sort???? (which of course is not what it finds, since my id points to the form itself, not its definition) >> >> If so, what would be the right way to accomplish this? >> >> I mean, I'm using the url of the form as a form ID BECAUSE I need to be able, given an instance, to know where to get its form from. Is there a more standard way of doing this? >> >> >> Thanks >> m. >