Showing posts with label Java Script. Show all posts
Showing posts with label Java Script. Show all posts
Friday, October 4, 2013
Friday, September 20, 2013
JS : Warning on Browser Back Button
JS : Warning on Browser Back Button.
This Approach will not disable the browser back button. It will just show the warning message.
**********************************************************
public class PageB {
private RichForm f1;
private RichDocument d1;
private RichDecorativeBox db1;
private RichPanelHeader ph1;
private RichCommandButton cb1;
private RichCommandButton cb2;
private RichPanelBox pb1;
public void setF1(RichForm f1) {
this.f1 = f1;
}
public RichForm getF1() {
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
service.addScript(fctx, "window.onbeforeunload = function () { if (logoutAction==0) {return 'Are you sure for going Back:: Neelmani Jaiswal'}; }");
return f1;
}
This Approach will not disable the browser back button. It will just show the warning message.
**********************************************************
public class PageB {
private RichForm f1;
private RichDocument d1;
private RichDecorativeBox db1;
private RichPanelHeader ph1;
private RichCommandButton cb1;
private RichCommandButton cb2;
private RichPanelBox pb1;
public void setF1(RichForm f1) {
this.f1 = f1;
}
public RichForm getF1() {
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
service.addScript(fctx, "window.onbeforeunload = function () { if (logoutAction==0) {return 'Are you sure for going Back:: Neelmani Jaiswal'}; }");
return f1;
}
Saturday, May 11, 2013
ADF 11G : How to show the Processing state using Java Script?
ADF 11G : How to show the Processing state using Java Script?

Java Scripts
function enforcePreventUserInput(evt){
var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');
if (popup != null){
AdfPage.PAGE.addBusyStateListener(popup,handleBusyState);
evt.preventUserInput();
}
}
function handleBusyState(evt){
var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1'); //P1 is the popupId. which have images.
if(popup!=null){
if (evt.isBusy()){
popup.show();
}
else{
popup.hide();
AdfPage.PAGE.removeBusyStateListener(popup, handleBusyState);
}
}
}
Command button code

Code for popup:
Java Scripts
function enforcePreventUserInput(evt){
var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');
if (popup != null){
AdfPage.PAGE.addBusyStateListener(popup,handleBusyState);
evt.preventUserInput();
}
}
function handleBusyState(evt){
var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1'); //P1 is the popupId. which have images.
if(popup!=null){
if (evt.isBusy()){
popup.show();
}
else{
popup.hide();
AdfPage.PAGE.removeBusyStateListener(popup, handleBusyState);
}
}
}
Command button code
Code for popup:
Tuesday, March 19, 2013
ADF 11G : How to Close a popup using JavaScript ?
ADF 11G : How to Close a popup using JavaScript ?
hh



hh
JSF : How to Add Javascript from Bean in JSF ?
JSF : How to Add Javascript from Bean in JSF ?


public String callJS() {
FacesContext facesContext = FacesContext.getCurrentInstance();
org.apache.myfaces.trinidad.render.ExtendedRenderKitService service =
org.apache.myfaces.trinidad.util.Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext, "alert('Hi');window.close();");
return null;
}
public String callJS() {
FacesContext facesContext = FacesContext.getCurrentInstance();
org.apache.myfaces.trinidad.render.ExtendedRenderKitService service =
org.apache.myfaces.trinidad.util.Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext, "alert('Hi');window.close();");
return null;
}





