Step1
Let us say our value change listener is as follows
import javax.faces.context.FacesContext;
import javax.faces.application.FacesMessage;
public void onChangeCompanyName(ValueChangeEvent valueChangeEvent) {
FacesMessage msg = new FacesMessage("In the value change listener of company");
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, msg);
}
Step2
Our javascript should be
function callValueChangeEvent(evt) {
//Method to get component using id (here inputText)
var field = AdfPage.PAGE.findComponentByAbsoluteId('it1');
//Change(set) field's value
field.setValue('I am JavaScript text');
//Get New changed value
var newVal = field.getValue();
//Queue ValueChangeEvent (component,oldValue,newValue,autoSubmit)
AdfValueChangeEvent.queue(field, null, newVal, false);
}
Let us say our value change listener is as follows
import javax.faces.context.FacesContext;
import javax.faces.application.FacesMessage;
public void onChangeCompanyName(ValueChangeEvent valueChangeEvent) {
FacesMessage msg = new FacesMessage("In the value change listener of company");
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, msg);
}
Step2
Our javascript should be
function callValueChangeEvent(evt) {
//Method to get component using id (here inputText)
var field = AdfPage.PAGE.findComponentByAbsoluteId('it1');
//Change(set) field's value
field.setValue('I am JavaScript text');
//Get New changed value
var newVal = field.getValue();
//Queue ValueChangeEvent (component,oldValue,newValue,autoSubmit)
AdfValueChangeEvent.queue(field, null, newVal, false);
}
No comments:
Post a Comment