Dynamic action to execute PL/SQL that calls a JavaScript alert - does not

Greetings,

I'm stuck!  I use the Apex Version 4.2.2.  I have a requirement that, when the user fills Field1, I check the database to see if the value of field1 has already been used.  If it was used, I have to inform the user, but the user is allowed to reuse the value - that is to say, duplicates are allowed.  My thought is to use a dynamic action to check the onchange of value running pl/sql to check (via a function in the database) and if it returns true, use a javascript alert to inform my user value is used.  They can then close the alert and change (or not change) the duplicate value

I did the following:

1 wrote a PL/SQL function in my utility package in the database - we'll call it apps.my_utils.check_value_use (p_my_val in varchar2) return Boolean - it works.

2. created a dynamic Action with the following properties for P1_FIELD1:

Event: change

Selection type: item (s)

Product (s): P1_FIELD1

Condition: is not null

3. the dynamic Action has an action - real Action

Action: Execute the PL/SQL Code

Page items to submit: P1_FIELD1

PL/SQL code:

BEGIN

IF apps.my_utils.check_value_use(:P1_FIELD1) = TRUE THEN

HTP.p ("< script type =" text/javascript "> '");

HTP.p ("alert (" this value is used ""); ")

');

HTP.p ("< /script >" ");

END IF;

END;

When I run the page and fill in Field1 with a value that I know is in use, I get the following error:

Error: parsererror - SyntaxError: JSON.parse: unexpected character

Help, please.  I already spent too much time on this apparently simple requirement.

Thank you

J.

BEGIN

IF apps.my_utils.check_value_use(:P1_FIELD1) = TRUE THEN

HTP.p(' ');

END IF;

END;

Avoid doing this. Try the following method:

(1) create a dummy hidden element to store the result of your validation of PL/SQL. Lets call it P1_DA_ERR

(2) in your PL/SQL block put this point hidden in the field "Page point back.

(3) in your PL/SQL block placed the result of your validation in this element hidden as

DECLARE
l_err PLS_INTEGER := 0;
BEGIN
-- An example
IF 1=1 THEN
l_err := 0;
ELSE
l_err := 1;
end if;
:P1_DA_ERR := l_err;
END;

(4) add a true other "Run Javascript code" type action. The could should look like:

if(parseFloat($v('P1_DA_ERR'))==1)
{
alert('Error occurred');
}

Tags: Database

Similar Questions

  • buy an iphone 5s by amazon and I came with iCloud blocked an account... {I called the seller and does not that I do that I'm from Venezuela please need your help}

    buy an iphone 5s by amazon and I came with iCloud blocked an account... I called the seller and does not that I do that I'm from Venezuela please need your help

    No one here can help you. The device is locked activation. Since you have made the purchase by Amazon, you can check with them to see if they will stand behind it. No one on the forum, or Apple can help you remove the lock. Only the previous owner can do this. I suggest that you demand a refund, so let's start a claim with Amazon about this dealer.

  • I created a Javascript script that adds a watermark on the document action "paper print".  This works in Acrobat Pro, but does not work in the drive.

    I created a Javascript script that adds a watermark on the document action "paper print".  This works in Acrobat Pro, but does not work in the drive.  I am a novice using Javascript, so what am I doing wrong?

    Cannot use either addWatermarkFromFile or addWatermarkFromText methods of document with player as shown in the documentation. You can hide/display the form fields and the existing layers, so consider this approach.

  • Error (20.22): PL/SQL: ORA-00942: table or view does not exist

    I get currently getting an error when I try and insert into a table of a different pattern of my stored procedure:
    Error (20.22): PL/SQL: ORA-00942: table or view does not exist

    I am explicitly calling the table with the name of the schema that is infront

    INSERT INTO SAPSR3. ZTREC_NAME_TYPE
    (
    MASTER_ID,
    NAME_TYPE,
    FAMILY_NAME,
    FIRST NAME,
    MIDDLE_NAME,
    TITLE
    )
    VALUES
    (
    In_MasterID,
    In_NameType,
    In_FamilyName,
    In_FirstName,
    In_MiddleName,
    In_Title
    );

    Only, I get this error when I try to compile my stored procedure. If I try this insert not within a stored procedure (for example, an empty script) it works perfectly.

    Can someone tell me what Im doing wrong?

    Thank you.

    Hello

    Looks like you (the owner of the procedure) have privileges on that table only through a role.
    Roles do not count in the stored procedures created with AUTHID OWNER (which is the default).

    Or the other
    (1) user SAPSR3 have the privileges needed directly at you (or public), or
    (2) change the procedure so that it runs with the privileges of the caller, adding AUTHID CURRENT_USER after the list of arguments, but before the keyword IS (AS os) like this:

    CREATE OR REPLACE PROCEDURE     foo
    (     x     IN     NUMBER
    )
    AUTHID CURRENT_USER
    IS ...
    
  • Error (301,28): PL/SQL: ORA-00942: table or view does not exist

    Hi all

    11.2.0.3.10

    AIX6

    I was installing store_procedures on our PROD several times, and they are successful. This stored_procedures are created by developers and once tested on DEV & UAT, they are transferred to the PROD through me.

    But this time I install a new SP, but I got error > Error (301,28): PL/SQL: ORA-00942: table or view does not exist

    Even if the synonym. The owner of the schema of the SP has grant select on the table and synonym of created. Why not MS can see this synonym?

    Is there something that I missed?

    Help, please... I'm going crazy

    Thank you all,

    MK

    Since there is only one user in your role, so I'll suggest to directly grant you the user rather than role - it's the easiest and simplest account according to your needs. The roles are best used to organize all of the users. If ever it is necessary to use roles (i.e. multiple users/schemas in a role) then, I think, you can play with AUTHID clause creating blocks.

  • How to create (or delete) a new tag for a Web site, so that his tag appears (or does not appear) whenever I restart Firefox?

    How to create (or delete) a new tag for a Web site, so that his tag appears (or does not appear) whenever I restart Firefox?

    See this - https://support.mozilla.org/en-US/kb/How%20to%20set%20the%20home%20page

  • IPhone 6 IOS 9.3.1 does not ring when a call comes, neither text does not sound a notification.

    IPhone 6 IOS 9.3.1 does not ring when a call comes, neither text does not sound a notification.

    Have you checked the obvious things? E.g.Ring/Silent switch on the left side is not on? Control the volume of ringtone under settings/sounds?

    If they are not serious then have you tried power the phone off and on again? Other sounds work fine, or if all sounds are dumb? for example can play you music through the speaker?

  • HP50g - nested call local procedure - why does not work

    I am attaching the simple test program to illustrate the problem

    «
    "Ť N".
    "N N."
    »
    »
    '2 AA EVAL '.
    "AA BB Ť
    '3 AA BB EVAL EVAL '.
    »
    »

    (Ť means arrow to the right).

    Two local procedures are defined: the 1st (AA) makes the place of its setting and the 2nd (BB)

    calls AA.

    I expect 9 and 4 as the result (3 and 2 places). But the program gives:

    9

    2

    'AA '.

    Then call AA of BB does not work, why? How to make it work?

    Someone might he say?, thanks

    Resolved, solution was using local variables compiled, thanks anyway

  • WHY IS THAT FIREFOX ALWAYS GEL AND DOES NOT?

    When I started using firefox on facebook it works well for a bit, and then it starts does not or not is very slow. I never had problems with firefox until these latest updates. What could be the problem. It is very frustrating and I've always liked this help so far.

    I deleted the program and reloaded it and have the same

    WHY IS THAT FIREFOX ALWAYS GEL AND DOES NOT?

    I deleted the program and reloaded it and have the same

  • With the help of 5s with ios 9.2.1. Call ringtone but screen does not show the answer since mode. Could not receive call and not able to see the contact call. This may be due to whatsapp.

    With the help of 5s with ios 9.2.1. Call ringtone but screen does not show the answer since mode. Could not receive call and not able to see the contact call. This may be due to whatsapp bug. Please specify.

    bjmrao wrote:

    With the help of 5s with ios 9.2.1. Call ringtone but screen does not show the answer since mode. Could not receive call and not able to see the contact call. This may be due to whatsapp bug. Please specify.

    Please ask Whatapps since you use their app.

  • HP 7612: I have a 7612 Officejet from HP that worked wireless but now does not work. When I try to

    I have a 7612 Officejet from HP that worked wireless but now does not work.  When I try to open the Network Setup Wizard a message indicating "wireless communication has been disabled. Can someone please?

    Thank you!

    hhmenar

    Hey @hlhmenar,

    Welcome to the Forums of HP Support!

    I understand that you are experiencing some problems with the wireless settings is disabled on your Officejet Wide Format e-all-in-one printer. I can help you with that.

    I'll send you some instructions describing how to do a factory reset on your printer. If you check your Inbox of forum you should see happens shortly.

    Please let me know the results after following the above. If you can run the wireless setup, click on accept solution. If you appreciate my help, please click on the thumbs up icon. The two icons are below this post.

  • I can't access my hotmail account! Recovery option that was sent to me does not work either, it always tells me that my account is blocked.

    I can't access my hotmail account! Recovery option that was sent to me does not work either, it always tells me that my account is blocked.

    What can I do to get this corrected counts

    Hello

    The best place to ask your question of Windows Live is inside Windows Live help forums. Experts specialize in all things, Windows Live, and would be delighted to help you with your questions. Please choose a product below to be redirected to the appropriate community:

    Windows Live Mail

    Windows Live Hotmail

    Windows Live Messenger

    Looking for a different product to Windows Live? Visit the home page Windows Live Help for the complete list of Windows Live forums at www.windowslivehelp.com.

  • The music that is on my Clip does not appear on my computer.

    I like my video, but I'm having some problems with it.

    I am trying to remove the muisc out of my Clip and put different music on it, but the music that was on my video does not seem to exist, according to my computer. When I plug my video into my computer and open Rhapsody, or even the element itself (through the workstation then drive L: SANSA CLIP) I can't find any music on this subject. I activated the hidden files, and that's what I see:

    All of these files are empty, except for REGISTRATION with an empty FM and an empty folder of VOICE in it.

    Yet, the music is still on my Clip. I can unplug my computer and listen to it (and no, this isn't the radio).

    How can I find this music and down, so I can put new music on it, or I'm stuck with the same songs forever?

    you connect in MSC mode, and probably, you copied the files on in MTP mode.  go to settings > usb mode > and select MTP. You should then be able to see your music when you connect it to the computer.

  • I can't get adobe to work and when I look in ms confing is shows that it is stopped and does not work how can I run past

    i cant get adobe flash player to work and when I look in ms confing is shows that he is arrested and does not work how can I change to run again

    Hello

    This can help you:

    Download and run the Flash Player uninstaller program.

    http://helpx.Adobe.com/Flash-Player/KB/uninstall-Flash-Player-Windows.html

    Then download and install Flash Player; After unchecking installing Chrome and Google toolbar option:

    http://get.Adobe.com/flashplayer/?promoid=BUIGP

    If the problem persists, you may want to ask in the Forums of community Flash Player:

    http://forums.Adobe.com/community/flashplayer

    See you soon.

  • Receive the error message "the server that you are connected using a security certificate that could not be verified that the certificate CN name does not match the passed value.

    Prob Winmail.

    Receive the error message "the server that you are connected using a security certificate that could not be verified that the certificate CN name does not match the passed value. Do you want to continue? ». This started happening after that my laptop has been reformatted. I have synced with Gmail winmail and followed the instructions to do this correctly. By pressing the tab 'Yes' allows me to use winmail, but it's a little embarrassing.

    Using a digital signature?  Check the settings under Tools | Options | Security and also tools | Accounts | Mail | Properties | Security.

    Also, see here (http://mail.google.com/support/bin/answer.py?hl=en&answer=86382) and make sure that your settings are correct.

    Steve

Maybe you are looking for

  • Portege R830 - updates BIOS and USB 3

    Hi all I have a Toshiba Portege R830, business management Windows 7 (SP1) 32-bit (for work).I also start Linux Mint 14 64-bit, that I installed it on a portable USB HDD (non-professional). I recently bought a 3 USB HARD drive, but when I connect it t

  • I would add an SSD in the second Bay of a HP Pavilion dv7t Quad Edition.

    I would add an SSD in the second Bay of a HP Pavilion dv7t Quad Edition. It's a SATA II or III?

  • Computer does not open a floppy disk. He continues to say that they need to get in shape

    my machine does not open a floppy disk.  He continues to say that they need to be formatted (even brand new ones that really don't need). so I told him to get in shape. within 30-45 seconds, a screen appears and tells me that the disk cannot be forma

  • XP PRO 3500 HP

    My company bought 50 pcs of Microtour HP Pro 3500 with free back installed and 50 OEM XP Pro license. Problem is that this model has a SATA hard drive. I tried to add some SATA drivers to my XP Pro cd, but it didn't work. Microtour HP Pro 3500 has H6

  • Moving Raid drives Bad Phy Slot

    I need someone to tell me if my approach is correct.  We have a Poweredge 2950 connected to an Powervault MD1000 with a bad location.  We have an another Powervault MD1000 that we'll use to replace it.  Since it is the same model table, what have we