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!

How to revert the value of a switch component with javascript D.A.

Jose ArósteguiNov 11 2021

Hi experts,
I'm using Apex 19.2 and I have a Switch component with a D.A. on Change to show a popup for user's confirmation of changing the value of this switch:

apex.message.confirm('Are you sure?', function(okPressed) {
  if(okPressed){
    apex.page.submit('DELETE_PROJECT');   
  } else {
    //Revert value
    if ($v('P30_BILLABLE')=='Y') 
      $s('P30_BILLABLE', 'N');
    else
      $s('P30_BILLABLE', 'Y');    
  }
 });

The idea is to revert the switch value to its original value, if user press cancel in the confirm dialog.
But it seems that using $s to set the value again, the D.A. is triggering again so I have a loop of messages.
Any ideas?
Thanks,
Jose.

This post has been answered by fac586 on Nov 12 2021
Jump to Answer
Comments
Post Details
Added on Nov 11 2021
4 comments
318 views