Run Time Validation Or Validation From Dynamic Action By JavaScript in Oracle Apex
STEP-1: CREATE JS FUNCTION ON PAGE LEVEL JUST PASTE THE BELOW CODE
function myerror(){
var myval = apex.item('P6_ERR').getValue();//document.getElementById('P6_ERR').value;
apex.message.clearErrors();
apex.message.showErrors(
[
{
"type": "error",
"location": "page",
"message": myval
}]
);
}
STEP-2: CALL THE FUNCTION ON ONCHANGE EVENT ON YOUR SPECIFIC ITEM ON CUSTOM ATTRIBUTE
onchange="myerror();"
STEP-3: CREATE A DYNAMIC ACTION ON CLICK OR AS YOU WISH PASTHE BELOW SAMPLE CODE
EVENT: CLICK
ACTION: EXECUTE PL/SQL CODE
BEGIN
IF LENGTH(:P6_NEW)>=10 THEN
:P6_ERR :='Length must not exceed 10 digit....';
--RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit....');
elsif LENGTH(:P6_NEW)>=5 THEN
:P6_ERR :='Length must not exceed 4 digit....';
end if;
exception
when others then
:P6_ERR :=SQLERRM;
--RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit');
END;
STEP-1: CREATE JS FUNCTION ON PAGE LEVEL JUST PASTE THE BELOW CODE
function myerror(){
var myval = apex.item('P6_ERR').getValue();//document.getElementById('P6_ERR').value;
apex.message.clearErrors();
apex.message.showErrors(
[
{
"type": "error",
"location": "page",
"message": myval
}]
);
}
STEP-2: CALL THE FUNCTION ON ONCHANGE EVENT ON YOUR SPECIFIC ITEM ON CUSTOM ATTRIBUTE
onchange="myerror();"
STEP-3: CREATE A DYNAMIC ACTION ON CLICK OR AS YOU WISH PASTHE BELOW SAMPLE CODE
EVENT: CLICK
ACTION: EXECUTE PL/SQL CODE
BEGIN
IF LENGTH(:P6_NEW)>=10 THEN
:P6_ERR :='Length must not exceed 10 digit....';
--RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit....');
elsif LENGTH(:P6_NEW)>=5 THEN
:P6_ERR :='Length must not exceed 4 digit....';
end if;
exception
when others then
:P6_ERR :=SQLERRM;
--RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit');
END;
No comments:
Post a Comment