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

Error messages from HiddenWidgets / Handling of compound error messages #46

Open
dairiki opened this issue Sep 14, 2011 · 2 comments
Open

Comments

@dairiki
Copy link
Contributor

dairiki commented Sep 14, 2011

I've noticed that error messages triggered by hidden fields (e.g. fields using a HiddenWidget) do not get displayed. I think the solution to this is for MappingWidget to get a custom handle_error method which will stick the messages from any hidden subfields into the mapping's error messages.

While looking into this, I noticed a second issue. Some parts of deform properly handle array-valued Invalid.msgs (see, e.g., mapping_item.pt, sequence_item.pt); other parts expect a scalar string value (e.g. mapping.pt).

I think that compound (array-valued) error messages should be allowed on any Invalid instance. To that end:

  • mapping.pt should be fixed to support compound error messages
  • Field.errormsg needs attention. My suggestion is that, in the case of compound error messages, it should return '\n'.join(msg). It should also probably be deprecated.
  • TextAreaCSVWidget.handle_error and TextInputCSVWidget.handle_error should put compound error messages in a array rather than concatenating them into a single string. (Also the example at the end of the handle_error part of the "Writing Your Own Widget" doc section should be updated.)

I'm willing to formulate this as a pull request, but I wanted to run it by you first to make sure that it all sounds reasonable.

@kiorky
Copy link
Member

kiorky commented Sep 21, 2012

Thx for this clear report !

I think that you can try to make a pullrequest to make your idea have a more formal state and we will review it
For me it sounds good.
Please add tests & docs !

@kiorky kiorky closed this as completed Sep 21, 2012
@mcdonc mcdonc reopened this Sep 21, 2012
@miohtama
Copy link
Contributor

miohtama commented Dec 6, 2016

Pull requests still welcome.

@stevepiercy stevepiercy added this to the 3.1.0 milestone Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants