Bug 5685: [OPAC follow-up] Validation of email address field

This patch makes a few changes to the way errors are handled in the
OPAC:

- The validation plugin has been moved from the global include file to
  the template itself. Since we aren't doing form validation on any
  other page yet it doesn't make sense to include it globally at this
  time.

- The error message which appears if you have JavaScript disabled and
  have submitted invalid emails was styled in a non-standard way.

- I have added in-page links to the error message which appears if you
  have JavaScript disabled so that you can click to jump to the field
  which contains the error.

- I have modified the error message language slightly to make it (I
  hope) read better.

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2014-10-23 09:50:38 -04:00 committed by Tomas Cohen Arazi
parent 342a7a1205
commit cf5df6590d
2 changed files with 6 additions and 6 deletions

View File

@ -79,7 +79,6 @@
<!-- JavaScript includes -->
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/jquery.js"></script>
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.validate.min.js"></script>
<script type="text/javascript">
// Resolve name collision between jQuery UI and Twitter Bootstrap
$.widget.bridge('uitooltip', $.ui.tooltip);

View File

@ -51,15 +51,15 @@
[% END %]
[% IF invalid_form_fields %]
<div class="alert-error"><strong>The following fields are invalid:</strong>
<div class="alert alert-error"><strong>The following fields contain invalid information:</strong>
<ul>
[% FOREACH field IN invalid_form_fields %]
[% IF field == "email" %]<li>Primary contact information: primary email address</li>[% END %]
[% IF field == "emailpro" %]<li>Primary contact information: secondary email address</li>[% END %]
[% IF field == "B_email" %]<li>Alternative contact information: email address</li>[% END %]
[% IF field == "email" %]<li>Contact information: <a href="#borrower_email">primary email address</a></li>[% END %]
[% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
[% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
[% END %]
</ul>
Please correct them.
Please correct the errors and resubmit.
</div>
[% END %]
@ -805,6 +805,7 @@
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.validate.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {