XLSForm / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
80 stars 136 forks source link

Proposal to change duplicate section name error message if equal to root node name #510

Closed MartijnR closed 3 years ago

MartijnR commented 3 years ago

Software and hardware versions

pyxform v1.3.3.

Problem description

When naming a group "data", the error message can be confusing.

type name label
begin group data A group
text a Enter text
end group    

The pyxform error message is "There are two sections with the name data."

Users would generally not understand what the other "data" section is (which is the root node).

Expected behavior

It may to helpful to add the following generic check to that section of code:

if duplicate section name equals the name of the root node, use error message: "The name "[NAME]" is the same as the form name. Use a different section name (or change the form name in the "name" column of the settings sheet)."

pinging @pbowen-oc

lognaturel commented 3 years ago

You'll also end up with a problem if you explicitly set the root name to foo and also have a group named foo, right? So I think the word "default" can be removed from the message.

MartijnR commented 3 years ago

Yes, indeed. Thanks! I'm updating this.

pbowen-oc commented 3 years ago

@gushil - Can you work on this issue?

gushil commented 3 years ago

@pbowen-oc

Sure, working on it.

gushil commented 3 years ago

@MartijnR I've created PR #511 to solve this issue. Thanks.

gushil commented 3 years ago

@MartijnR The failing tests on PR #511 are resolved. Waiting for the review/resolution.

Thanks!

pbowen-oc commented 3 years ago

@lognaturel - This is also catching items named data and showing the same error message as for groups/repeats: Error: The name "data" is the same as the form name. Use a different section name (or change the form name in the "name" column of the settings sheet).

Are you open to changing the text to not refer to a section or should this check not catch items at all?

Test form: Data item.xlsx