Skip Menu |

This queue is for tickets about the CGI-FormBuilder CPAN distribution.

Report information
The Basics
Id: 56083
Status: rejected
Priority: 0/
Queue: CGI-FormBuilder

People
Owner: Nobody in particular
Requestors: brian@massassi.com (no email address)
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.0501
Fixed in: (no value)



Subject: Error message for "missing" fields is the same as for "invalid" fields
When using javascript => 0 option, make a form with a required field, leave it blank, then submit it. The error message comes back as "Invalid entry." While indeed it's invalid, it would be nice to be able to report to the user that the field cannot be left blank. Since there is only one "invalid" message type, using a custom message won't help (since it will also show up for fields that are invalid due to input errors as well). Attached is a patch that adds a new error message type, form_missing_input. I only added it to Messages/default.pm as I'm not sure how these are maintained.
Subject: missing_patch.patch
diff -u -r fb_orig\FormBuilder\Field.pm fb_msg\FormBuilder\Field.pm --- fb_orig\FormBuilder\Field.pm Mon Mar 29 12:58:10 2010 +++ fb_msg\FormBuilder\Field.pm Mon Mar 29 14:30:43 2010 @@ -509,6 +509,11 @@ my $type = shift || $self->type; my $et = 'form_invalid_' . ($type eq 'text' ? 'input' : $type); $et = 'form_invalid_input' if $self->other; # other fields assume text + + if($self->{'missing'}) { + $et = 'form_missing_input'; + } + $mess = sprintf(($self->{_form}{messages}->$et || $self->{_form}{messages}->form_invalid_default), $self->label); } diff -u -r fb_orig\FormBuilder\Messages\default.pm fb_msg\FormBuilder\Messages\default.pm --- fb_orig\FormBuilder\Messages\default.pm Mon Mar 29 12:58:10 2010 +++ fb_msg\FormBuilder\Messages\default.pm Mon Mar 29 14:30:43 2010 @@ -37,6 +37,7 @@ . 'Please correct the fields %shighlighted%s below.', form_invalid_input => 'Invalid entry', + form_missing_input => 'This field is required', form_invalid_hidden => 'Invalid entry', form_invalid_select => 'Select an option from this list', form_invalid_checkbox => 'Check one or more options',
This is an interesting thought, but there are too many translations depending on this that would need to be updated, and you only supplied English. At this time I'm going to close this as will not fix.