Silent errors on invalid form submissions

Bug #493951 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IVLE
Fix Released
Low
William Grant

Bug Description

At least one form fails silently if invalid form data is passed. This could be an idiom we're using but I don't really like it. I tried adding a field and it took me a very long time to discover why the validator wasn't working.

In the New Enrolments form:
http://ivle.localhost/subjects/ivle-102/2009/2/+enrolments/+new

Try adding (with Firebug) a new text field with a funny name, e.g., "foo". Now if you click Enrol, the page will refresh with no errors, as if nothing had happened.

Internally, in ivle/webapp/admin/subject.py, something is afoot! If you get an error validating, say, the "user" field, then the error object you get back will be something like {'user': 'User does not exist'}. This displays properly because our error reporting (in ivle/webapp/admin/templates/enrol.html) is:

<span py:if="'user' in errors" class="form_error">${errors.user}</span>

However, if the error is not with a particular field, but with the form itself, then the error object you get back will be u"The input field 'role' was not expected." (not a dictionary at all, but a string).

I think this error should be displayed somewhere, not just ignored. I can fix it in this particular instance, but I need to know if this is systemic or just an isolated case. ???

Tags: ui

Related branches

Revision history for this message
William Grant (wgrant) wrote :

New forms that I've added do not suffer from this problem. Anything deriving from BaseFormView just needs to have something like this in the template:

<div class="submit form_error" py:if="defined('error_value')" py:content="error_value" />

Changed in ivle:
status: New → Triaged
importance: Undecided → Medium
Matt Giuca (mgiuca)
Changed in ivle:
importance: Medium → Low
Matt Giuca (mgiuca)
Changed in ivle:
assignee: Matt Giuca (mgiuca) → nobody
William Grant (wgrant)
Changed in ivle:
assignee: nobody → William Grant (wgrant)
status: Triaged → In Progress
William Grant (wgrant)
Changed in ivle:
status: In Progress → Fix Committed
William Grant (wgrant)
Changed in ivle:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.