
edit_requester_info.js
About this file
Fields for editing the requester information are given the data-parsley-required attribute and a validation message. Fields are also given a character limit.
Restrictions are made for the telephone and fax fields so that non-numerical characters are not allowed.
As long as one of the required fields is filled out, the form is valid. Otherwise, an error message is displayed in html indicating that one of the required fields (in strong tags) needs to be filled out.
Code Issues
-
Lines 28-34 (shown below) has an event listener for key press. Needs a comment stating what characters correspond
to charCodes 48 and 57.
telephone.keypress(function (key) { if (key.charCode !== 0) { if (key.charCode < 48 || key.charCode > 57) { key.preventDefault(); } } });
-
There is a long conditional statement on lines 96-106 with a mix of && and ||.
if (email.parsley().isValid() || telephone.parsley().isValid() || fax.parsley().isValid() || ( // mailing address addressOne.parsley().isValid() && state.parsley().isValid() && zipCode.parsley().isValid() && city.parsley().isValid() ) )
Code Check Report
94:51 warning Function has a complexity of 9 complexity ✖ 1 problem (0 errors, 1 warning)
Documentation drawn from source code
$(function () {
requesterModal.on("shown.bs.modal", function () {
$("#agencyModal").on("shown.bs.modal", function () {
telephone.keypress(function (key) {
fax.keypress(function (key) {
requesterModal.on("show.bs.modal", function () {
$("#user-info").parsley().on("form:validate", function () {
requesterModal.on("hidden.bs.modal", function () {
title.keyup(function() {
organization.keyup(function() {