
new_request_anon.js.html
About this file
This file displays the agency information for a new request form by an anonymous user. Validation errors and checks are added to necessary inputs that are needed prior to submitting the form.
Code Issues
- Needs a comment clarifying what kiosk_mode means.
- The keypress event handler for entering phone and fax numbers are the same. Can refactor the functioon in the event handler by providing a function name, and then calling that function for both events.
- Lines 170-226 involve setting attributes for HTML entities. However, some of these entities have more than on attribute being set. Recommend implementing a function that sets a list or object of attributes for an entity.
-
The
if
statement below has a mixture of || and &&. Recommend implementing a function that validates address.if ($("#email").parsley().isValid() || $("#phone").parsley().isValid() || $("#fax").parsley().isValid() || ($("#address-line-1").parsley().isValid() && $("#state").parsley().isValid() && $( "#zipcode").parsley().isValid() && $("#city").parsley().isValid()) )
Code Check Report
Documentation drawn from source code
/* globals characterCounter: true */
/* globals getRequestAgencyInstructions: true */
/* globals getCustomRequestForms: true */
/* globals renderCustomRequestForm: true */
/* globals processCustomRequestForms: true */
/* globals requiredFields: true */
/* globals showPIIWarning: true */
$(document).ready(function () {
$(window).load(function () {
$("#phone").keypress(function (key) {
$("#fax").keypress(function (key) {
$("#request-category").change(function () {
success: function (data) {
$("#request-agency").change(function () {
$(document).on("focus", ".request-type", function () {
$(targetId).off().change(function () {
$("#change-category-button").off().click(function () {
$("#cancel-change-category-button").off().click(function () {
$(document).on("click", ".panel-dismiss", function () {
$("#custom-request-form-additional-content").click(function () {
$("#request-file").change(function () {
$("#clear-file").click(function () {
$("#choose-file span[role=button]").bind("keypress keyup", function (e) {
$("#request-form").parsley().on("form:validate", function () {
$("#request-form").parsley().on("form:error", function () {
$(".parsley-required").each(function () {
$(".parsley-length").each(function () {
$("#submit").click(function () {
$("#request-file").change(function () {
$("#request-form").on("submit", function (e) {
$(this).submit(function () {
$("#request-title").keyup(function () {
$("#request-description").keyup(function () {
$("#first-name").keyup(function () {
$("#last-name").keyup(function () {
$("#user-title").keyup(function () {
$("#user-organization").keyup(function () {