Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 80307

Re: Struggling with form validation

$
0
0

So I have has another go at it and hope I have cleaned it up a bit. Any further suggestion for me please?

event.rc = true;

var errorMsg = new Array(8);

if (this.getField("workOrderNumber").value == "") {

    errorMsg[0] = ("You cannot proceed without a requisition number please click in the top right field to generate a number");

}

if (this.getField("DelAddressRow1").value == "") {

    errorMsg[1] = ("Please enter the full delivery address");

}

if (this.getField("DeliveryContactName").value == "") {

    errorMsg[2] = ("Please enter the delivery contact");

}

if (this.getField("SupplierNameRow1").value == "") {

    errorMsg[3] = ("Please enter the full name of the proposed supplier");

}

if (this.getField("SupplierAddressRow1").value == "") {

    errorMsg[4] = ("Please enter the street number, name and type");

}

if (this.getField("SupplierAddressRow2").value == "") {

    errorMsg[5] = ("Please enter the suburb, state and postcode");

}

if (this.getField("SupplierContactName").value == "") {

    errorMsg[6] = ("Please enter the supplier contact name");

}

if (this.getField("SupplierContactTelephone").value == "") {

    errorMsg[7] = ("Please enter the suppliers telephone number.\n");

}

if (errorMsg != "")

    {

        var msg = new Array(errorMsg[0],errorMsg[1],errorMsg[2],errorMsg[3],errorMsg[4],errorMsg[5],errorMsg[6] ,errorMsg[7]);

        msg.sort();

        for (i=0;i<msglength;i++) {

            alert("There were some required fields you must complete...\n" + msg[i] + "\n");

    }

        else if (msg === "");

    {

    var cToAddr = "my email....";

    var cSubLine = "Requisition: " + this.getField("workOrderNumber").value;

    var cBody = "Thank you for submitting your form.\n" + "Save the filled form attachment for your own records";

    // Send the entire PDF as a file attachment on an email

    this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody});

    }

    }


Viewing all articles
Browse latest Browse all 80307

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>