Validation

 

Unique Validation
============

Create Validation on SUPPLIER_NAME item.

Validation Name: Unique_supplier_name

  Type: No Rows Returned

--> SQL Query :

select SUPPLIER_NAME

from   SUPPLIER

where  upper(SUPPLIER_NAME) = upper(:P8_SUPPLIER_NAME);

--> Error massage : This SUPPLIER NAME already Exists...

--> Server-side Condition:

 When Button Pressed: CREATE 


Not Null Validation
=============

Create Validation on SUPPLIER_NAME item.

Validation Name : Not_Null_SUPPLIER_NAME

  Type: Item is Not Null

  Item: P8_SUPPLIER_NAME

Error :

 Error Message: You can not blank Supplier name field...

Email Validation Item Matches Regular Expression
===================================

Create Validation on "EMAIL" item. 

Validation:

  Type: Item Matches Regular Expression

  Item: P8_EMAIL

  Regular Expression: @

Error Message: Your E-mail address invalid. 

===============================================


JavaScript Validation when Selective Item is Null:

Create Dynamic Action On Button.
Action Name: Null_Check
Execute JavaScript Code:

// Check for empty fields

var poHeader  = $v("P12802_PO_HEADER_ID");
var challan   = $v("P12802_CHALLAN_NO");
var vendor    = $v("P12802_VENDOR_NAME");
var warehouse = $v("P12802_TO_WAREHOUSE_ID");
var project   = $v("P12802_TO_PROJECT_ID");

if (!poHeader || !challan || !vendor || !warehouse || !project) {

      // Remove old message if exists
    $("#customAlert").remove();


    // Create a div with styled button and Alert Position

    $("body").append(`

        <div id="customAlert" style="

            position: fixed;

            top: 40%;  

            left: 50%;

            transform: translateX(-50%);

            background: #fff;

            border: 2px solid red;

            color: red;

            padding: 20px;

            z-index: 9999;

            font-weight: bold;

            box-shadow: 0 0 10px rgba(0,0,0,0.5);

            width: 500px;

            height: 100px;

        ">

    Please, fill in the PO Number, Vendor, Challan, Warehouse and Project. Thank You.

            <button id="closeAlert" style="

                position: absolute;

                bottom: 10px;

                right: 10px;

                background: red;

                color: #fff;

                border: none;

                padding: 5px 10px;

                cursor: pointer;

            "> Close </button>

        </div>

    `);


    // Close button functionality

    $("#closeAlert").click(function(){

        $("#customAlert").remove();

    });


    return false; // Stop submit

}

Post a Comment

Previous Post Next Post