Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger referring to repeat question has relative ref attribute #477

Closed
MartijnR opened this issue Nov 6, 2020 · 4 comments · Fixed by #478
Closed

Trigger referring to repeat question has relative ref attribute #477

MartijnR opened this issue Nov 6, 2020 · 4 comments · Fixed by #478

Comments

@MartijnR
Copy link
Contributor

MartijnR commented Nov 6, 2020

Software and hardware versions

Last commit in master of Oct 29th, 2020

Problem description

If a trigger refers to a question inside a repeat, the ref attribute value is relative. Though this is strictly speaking correct in XForms, in pyxform we've so far always used absolute references and could do so in this case too. This would be more consistent. The real problem is that a relative reference doesn't work in Enketo is not so easy to add support for.

Steps to reproduce the problem

type name label trigger calculation
begin repeat rep      
text one Enter text    
text three Enter text (triggered) ${one} concat('d', 'e')
end repeat        

This form doesn't pass ODK Validate (different issue) so run with --skip_validate.

The output contains <setvalue event="xforms-value-changed" ref=" ../three " value="concat('d', 'e')" />

Note the inconsistency with the other ref attributes in the same body that are all absolute including the three question itself.

Desired behavior

The desired output would contain <setvalue event="xforms-value-changed" ref=" /data/rep/three " value="concat('d', 'e')" /> instead.

Additional information

Both ref="/data/rep/three" attributes in the (desired) output refer to the same node (in the current repeat instance). They are binding expressions. As far as I can tell they have the exact same meaning in XForms.

@lognaturel
Copy link
Contributor

Thanks, @MartijnR, this makes sense. I think the Validate issue is actually the same one -- currently the ref is being contextualized against the root so ../three parents beyond what makes sense.

@MartijnR
Copy link
Contributor Author

MartijnR commented Nov 6, 2020

Thank you. That's very good, as we don't have to feel so bad about not supporting that in Enketo then! 👍 😆

@pbowen-oc
Copy link

One of our developers at OpenClinica can work on this.

@gushil - Please take a look.

@gushil gushil mentioned this issue Nov 13, 2020
4 tasks
@gushil
Copy link
Contributor

gushil commented Nov 13, 2020

Hi, @MartijnR I've created PR #478 to fix this issue.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants