Changing default text of af:dialog buttons (ok,cancel) in ADF

Sharing is Caring

Hello All,
you all have used pop up the component with af:dialog in ADF,
default dialog component looks like this inside popup

af:dialog

In ADF there is the option to change dialog type, select dialog component and go to property inspector

But sometimes we need to change default dialog button’s text as per our requirement, to do this follow steps mentioned below

  • Drag a popup having dialog as its child component on the page
  • select af:dialog in structure window and go to property inspector

 

    • In property inspector navigate Appearance—>Text

    • Now set values for Affirmative and cancel text

       

    • Now run your application and see-
    • But it’s outcome doesn’t get changed as it is static, you can see this in managed bean code, i have created dialog Listener and a cancelListener in managed bean

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import oracle.adf.view.rich.event.DialogEvent;
import oracle.adf.view.rich.event.PopupCanceledEvent;

public class DialogListenerBean {
    public DialogListenerBean() {
    }

    public void dialogListener(DialogEvent dialogEvent) {
FacesMessage msg = new FacesMessage("You have clicked- " + dialogEvent.getOutcome().name());
FacesContext.getCurrentInstance().addMessage(null, msg);
    }

    public void cancelListener(PopupCanceledEvent popupCanceledEvent) {
FacesMessage msg = new FacesMessage("You have clicked- cancel");
FacesContext.getCurrentInstance().addMessage(null, msg);
    }
}

 

  • When you click on ok and cancel (with changed text), it will return the same outcome that was before changing button’s text

 

Cheers- Merry Christmas 🙂

Related Posts

An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

2 thoughts on “Changing default text of af:dialog buttons (ok,cancel) in ADF”

Leave a Reply

Your email address will not be published. Required fields are marked *