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

use $field->get_message('unique') instead of $field->uniqe_message #2

Open
woosley opened this issue Jun 25, 2011 · 0 comments
Open

Comments

@woosley
Copy link

woosley commented Jun 25, 2011

According to the HTML::FormHandler::Field document, the unique message is set by

                messages => { required => '...', unique => '...' }

eg:

                 has_field 'id' => (
                            type     => 'Text',
                            required => 1,
                            accessor => 'username',
                            unique   => 1,
                            messages => {
                                   required => 'username is required',
                                   unique   => 'This user name is already taken'
                            },
                );

However, setting unique message dose not set $field->unique_message, then in this TraitFor::Model::DBIC(line 262), the unique message we get every time is "Duplicate value for [_1]". By using get_message('unique'), we can get the correct message.

return $self->unique_messages->{$constraint} ||= "Duplicate value for [_1] unique constraint" also suffers from the same problem, I did not dig into this part, so maybe there should be another fix.

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