orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
515 stars 221 forks source link

Conditional logic can cause an Orbeon form error #1508

Closed robshaffbbc closed 10 years ago

robshaffbbc commented 10 years ago

To recreate:

  1. In the form editor make a form with two controls: one text field and one Boolean check box.
  2. In the basic settings tab for the check box set the name to "acontrol"
  3. In the formulas tab for the text field under Visibility enter $acontrol = 'true'
  4. Save + Publish the form in the form editor
  5. In the form runner tick the check box and save the form.
  6. Reload the form and a form error will prevent the form runner from loading the form for editing.

Notes:

robshaffbbc commented 10 years ago

May or may not be related but putting $variable in the calculated value field when $variable is not defined produces a generic form error when running the form.

ebruchez commented 10 years ago

This is kind of by design: the idea is that such errors taking place during page initialization are usually programming errors. See also the doc on error handling.

It's a bit unclear how we should improve on this.

robshaffbbc commented 10 years ago

I think the main issue I had with this is that the user of the form has no idea what the problem is because the error message is just the standard form failed to load message. As for improvements I can think of a few options.

  1. Pre-validation of the code used in the settings tab but this could create difficulties if you are using fields from the form as you never know the full range of data the code will see in the form.
  2. There could be a more meaningful error message to indicate why the user can not open the form for editing (however I am not aware of any precedent set for this)
  3. Just ignore the field if the code in it is not working. (and the user potentially wont know the field is broken if it defaults to visible)

So all of these have weaknesses but might be better than a general "form failed to load" page.

ebruchez commented 10 years ago

I guess it depends which user you are talking about ;)

If it's the end user of the form, then that user should see a nice error page, maybe with a code to help with support. But the end user probably doesn't care what the exact XPath error might have caused the issue.

If the user is the programmer, then sure, the error message should be the best possible.

BTW, are you using the dev run mode? Because that mode is supposed to show a detailed error message in the browser.

robshaffbbc commented 10 years ago

OK that is a fair distinction to make. We currently do not customise the default error page for our end user but we could make that nicer. On the dev side we cannot use dev mode due to https://github.com/orbeon/orbeon-forms/issues/1492 so we will have a solution to this on the next upgrade.

robshaffbbc commented 10 years ago

Closed this on the assumption that the error message in dev mode clarifies the reason for the form error.

ebruchez commented 10 years ago

Thanks, you'll let us know if you have more ideas as to how to improve this.