Value Over Loaded "alert massage" By JavaScript

 

Container Over Loaded!!

Step 1 :
Go to page -->  Function and Global Variable Declaration

function  overLoad(){
    let capacityCbm =   $('#P312_CAPACITY_CBM').val();
    let totalAdded =   $('#P312_TOTAL_ADDED').val();
    let capacityCbmParse = parseFloat(capacityCbm) ;
    let totalAddedParse =  parseFloat(totalAdded) ;
  console.log(capacityCbmParse, totalAddedParse)
  if (capacityCbmParse != null && totalAddedParse > 0){
  if (totalAddedParse >= capacityCbmParse){
        alert('Container Over Loaded'); 
        document.getElementById("myBtn").disabled = true;     
    }
   else{
         document.getElementById("myBtn").disabled = false; 
   }
  }
  else{
        
null
  
  }
}

Step 2 :

Select P312_CAPACITY_CBM & P312_TOTAL_ADDED
Custom Attributes: onchange="overLoad();"

Step 3 :

Select Create Button and Static ID: myBtn


-------------------------------------------------------------------------

2nd Option 

Validation
========

IF :P318_CAPACITY_CBM <= :P318_TOTAL_ADDED
THEN return false;
else return true;
end if ;

Error Message : Container Over Loaded!!

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

3rd Option:


Step 1:
=====

Create a Dynamic Action on P16015_BATCH_ID item.
Action Name: CREATE Button Disable
True Action: Execute Server-side Code
PL/SQL Code:

DECLARE
    l_count NUMBER;
BEGIN
    IF :P16015_BATCH_ID IS NOT NULL THEN
        SELECT COUNT(*)
        INTO l_count
        FROM INV_TXN_REQUEST_HEADERS A,
             INV_TXN_REQUEST_LINES B
        WHERE A.REQUEST_ID = B.REQUEST_ID
        AND A.BATCH_ID = :P16015_BATCH_ID;
    ELSE
        l_count := NULL;
    END IF;

    :P16015_BATCH_VERIFY := l_count;
END;

Items to Submit: P16015_BATCH_ID
Items to Return: P16015_BATCH_VERIFY

Step 2:
=====
Again, True Action: Execute JavaScript Code
Code: 

var cnt = $v("P16015_BATCH_VERIFY");

// When P16015_BATCH_VERIFY is NULL, then don't show error
if (cnt === "" || cnt === null) {
    return;
}

// Convert to number
cnt = Number(cnt);

// COUNT = 0 then show error + button disable
if (cnt === 0) {

    apex.message.clearErrors();
    apex.message.showErrors([
        {
            type: "error",
            location: "page",
            message: "⚠️ No transaction data found for this Batch ID!",
            unsafe: false
        }
    ]);

    $("#CREATE").prop("disabled", true);
    return;
}

// COUNT > 0 then Button Enable + Error Clear
apex.message.clearErrors();
$("#CREATE").prop("disabled", false);


Button Static ID: CREATE






Post a Comment

Previous Post Next Post