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

improve validation to provide file upload error messages #97

Open
dbu opened this issue Apr 4, 2014 · 2 comments
Open

improve validation to provide file upload error messages #97

dbu opened this issue Apr 4, 2014 · 2 comments

Comments

@dbu
Copy link
Member

dbu commented Apr 4, 2014

in #82 the checks during transformation are improved, but we should see if we can validate UploadFile earlier to provide decent messages to the user.

@dbu dbu added the enhancement label Apr 4, 2014
@dbu
Copy link
Member Author

dbu commented Apr 17, 2014

@webmozart can you maybe help us? we throw an exception in a transformer and would like to show that exception as the validation error message as we know that the exception message would be useful to the end user. https://github.com/symfony-cmf/MediaBundle/blob/master/Form/DataTransformer/ModelToFileTransformer.php#L50

it seems we only are able to get the generic error message however.

@rmsint
Copy link
Contributor

rmsint commented Apr 17, 2014

Did have a look and I see a model normalization error causes the form to not be synchronized. The validator checks if a form is synchronized. See https://github.com/symfony/Form/blob/master/Form.php#L636 and https://github.com/symfony/Form/blob/master/Extension/Validator/Constraints/FormValidator.php#L98.

Maybe the config options invalid_message and invalid_message_parameters can be used to pass a specific upload error to the form? How could a model transformer do this?

@lsmith77 lsmith77 added this to the 1.3 milestone Jun 17, 2015
@dbu dbu removed this from the 1.3 milestone Feb 1, 2016
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

3 participants