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

Some problems during form completion result in exceptions during form filling or on form refilling but not on form validation #617

Open
lognaturel opened this issue Jan 13, 2021 · 0 comments

Comments

@lognaturel
Copy link
Member

lognaturel commented Jan 13, 2021

Software versions

All versions

Problem description

A calculation such as decimal-date-time(concat( /data/year ,"-01-01")) can result in an exception if /date/year is left blank or otherwise invalid. However, that exception doesn't occur on finalization so a form can be submitted with a bad value.

This is really a form design issue and /data/year should have a constraint on it. However, the form probably should not be finalizable if the value can't be used. I think there are similar cases with trying to access values in a repeat without specifying a repeat instance.

I'm not 100% sure this is a JavaRosa issue. It might also have to do with how Collect catches JR exceptions.

Steps to reproduce the problem

In a form like the following, clear out the year value:

<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms">
	<h:head>
		<h:title>validate</h:title>
		<model>
			<instance>
				<data id="validate">
					<year>2019</year>
					<result/>
				</data>
			</instance>
			<bind nodeset="/data/year" type="int"/>
			<bind calculate="decimal-date-time(concat( /data/year ,&quot;-01-01&quot;))" nodeset="/data/result" type="string"/>
		</model>
	</h:head>
	<h:body>
		<input ref="/data/year">
			<label>year</label>
		</input>
	</h:body>
</h:html>

Expected behavior

Forms that throw exceptions during form filling can't be finalized.

CC @seadowg

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

No branches or pull requests

1 participant