Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hide / Disable Button and Show Enable Button in APEX

Dj SteeleMar 29 2018 — edited Mar 30 2018

Hello Community,

I'm using Oracle APEX version 5.1.0.0045 , Google Chrome, and PL/SQL Developer

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

What I'm trying to accomplish working on a Refund Page for an Application:

   When a Receipt is Fully Refunded I want to Hide / Disable  the 'Refund' Button

and

 When a Receipt is Partially Refunded I want to Show / Enable the 'Refund' Button

Also

Can I utilize these in PL/SQL Function Body in APEX

apex.item( "refundButton" ).disable();

apex.item( "refundButton" ).enable(); (Seen in Code Below)

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

I have the following PL/SQL Code which tells me if a Refund is Fully Refunded or Partially Refunded; (which is Correct based on some Test Fields I used in APEX)

Declare

v_RecptAmt receiptdetail.receipt_amount%type;

v_refunded_receipt_amount receiptdetail.receipt_amount%type;

Begin

select nvl(rl.receipt_amount,0) - nvl(rd.postage,0) as "Receipt Amount",

           (select abs(nvl(sum(rdd.receipt\_amount),0))

           from receiptdetail rdd

           where refunded\_recpt\_nmbr = (select rd.receiptnumber

                                        from receiptdetail rd

                                             inner join

                                             receipt\_log rl

                                             on rd.receipt\_log\_id = rl.receipt\_log\_id

                                             where rd.receipt\_log\_id = :P64\_RECEIPT\_LOG\_ID))  as "Sum of Refunded Receipt Number"

into v_RecptAmt,

   v\_refunded\_receipt\_amount

from receiptdetail rd

      inner join

      receipt\_log rl

on rd.receipt_log_id = rl.receipt_log_id

where rl.receipt_log_id = :P64_RECEIPT_LOG_ID;

    if v\_refunded\_receipt\_amount >= v\_recptAmt

        then :P64\_DISABLE\_REFUNDBTN := 'Y';

              if :P64\_DISABLE\_REFUNDBTN = 'Y'

              then apex.item( "refundButton" ).disable();

              end if;

    else     :P64\_DISABLE\_REFUNDBTN := 'N';

              apex.item( "refundButton" ).disable();

              end if;

:P64_SUM_REFUNDED_RECEIPT_TEST := v_refunded_receipt_amount;

:P64_RECEIPT_AMOUNT_TEST := v_RecptAmt;

end;

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

ScreenShots of Example

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

I want to Hide or Disable 'Refund Button in this Case

pastedImage_9.png

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

I want to Show or Enable 'Refund' Button in this Case which is Correct

pastedImage_12.png

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

I have Tried the following Dynamic Action and Javascript

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

pastedImage_15.png

alert("Disable Refund Button " + $s("P64_DISABLE_REFUNDBTN"));

if ( $v("P64_DISABLE_REFUNDBTN") == 'Y' || $v("P64_DISABLE_REFUNDBTN") == 'N' ) {

if ( $v("P64\_DISABLE\_REFUNDBTN") == 'Y') {

    apex.item( "refundButton" ).disable();

}

if ( $v("P64\_DISABLE\_REFUNDBTN") == 'N') {

    apex.item( "refundButton" ).enable();

}

}

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

I have also Tried the following Dynamic Actions with the following Server Side Conditions on them

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

pastedImage_22.png

pastedImage_25.png

pastedImage_28.png

Thanks in Advance

DSteele41

This post has been answered by PMON on Mar 29 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2018
Added on Mar 29 2018
5 comments
4,793 views