[SOLVED] Autosubmit, ValueChangeListener & DB PKs
Hi there,
I have a creation page, with some components having their (Autosubmit) property to (True), applying some actions with (ValueChangeListener) property. The problem is that when autosubmit fires, it looks like it reserves a row in the DB (without) commit, so when I finish entering all data and trying to save record, i face an error that the primary key is already defined (too many objects for the primary key), and if I try to modify its value to another one, then I errors dissappear, but with two records saved in the DB.
So?
Message was edited by:
RJundi
Ok, i have already compared the inserted values with the DB, and there is no problem.
The page contains a set of dependent selectOneChoice elements with autosubmit euals to true and valueChangeListener retrieves Parameters (values) of each to re-populate the below selectOneChoice elements.
I figured out to stop the Validation messages for required fields, but the problem is that when trying to save, it raises an error that there are too many objects for the primary key field, and if I try to alter its value only and then save again, I find that two records are saved, one for the first value and another one for the second value.
Thanks in prior
RJundi
Similar Messages
-
Adf valueChangeListener autosubmit=true, execute code after update model
Hello.
I'm working with the valueChangeListener and autosubmit="true". I'll try to explain my situation
with an example.
jsp:
<af:form>
<af:panelForm>
<af:inputText
id="value1"
label="Value1"
value="#{index.myObject.value1}"
autoSubmit="true"
valueChangeListener="#{index.changeListener1}"/>
<af:inputText
id="value2"
label="Value2"
value="#{index.myObject.value2}"/>
</af:panelForm>
</af:form>
backing:
public class Index {
private MyObject myObject;
public Index() {
myObject = new MyObject();
public void changeListener1(ValueChangeEvent valueChangeEvent){
doSomethingWithMyObject(myObject);
// ... get/set of myObject
MyObject:
public class MyObject {
private String value1;
private String value2;
public MyObject() {}
//getters/setters...
}In the line doSomethingWithMyObject(myObject) i need myObject with the actual values in the user form.
in the example above, the first time the page is rendered and shows the inputs
if the user captures something in the 1st input and then hits the tab to go to the other input
the valueChangeEvent is fired, and the code in "index.changeListener1" executed, but at this moment
the model (myObject) hasn't been updated with the data that the user entered (Validation Phase).
So i need a way to execute my code called from the "valueChangeEvent" but after the model has been updated
Some notes about my problem:
- The doSomethingWithMyObject(myObject) could update data in myObject
- About binding="#{x.y}":
I know i can use the binding attribute in the tag <af:inputText binding="#{x.y}"> and then in the code of
the changelistener the binded component always have the most recent value from the user,
but i cant' use that, the method needs a MyObject instance.
- I don't think create a new instance of MyObject and populate it every time the event fires is a good way
- doSomethingWithMyObject" is a black box, so i don't know what is going to do with myObject
- In my problem there are more than 2 inputs there will be N components M listeners.
What I'm trying:
PhaseListener:
I have been implementing a solution with a PhaseListener like
public void afterPhase(PhaseEvent phaseEvent) {
// just after UPDATE_MODEL_VALUES phase
FacesContext f = FacesContext.getCurrentInstance();
Index i = (Index) f.getApplication().createValueBinding("#{index}").getValue(f);
// at this point the model is updated
doSomethingWithMyObject(i.getMyObject);
public PhaseId getPhaseId() {
return PhaseId.UPDATE_MODEL_VALUES;
this works but i don't know if this is the answer according to this post (unanswered at this time):
http://forums.oracle.com/forums/thread.jspa?threadID=611643
says something about that PhaseListener is not thread safe and blocks the application with more
than 1 user.
A wrapper:
using the controls binded to the backing
public class Index {
private MyObject myObject;
private CoreInputText inputValue1;
private CoreInputText inputValue2;
//listener
//getters/setters
} make a wraper like
public class MyObjectW {
private Index index; // wrap the backing index
public MyObjectW(Index index) {
this.index = index;
public String getValue1(){
return (String) index.getInputValue1().getValue();
public String getValue2(){
return (String) index.getInputValue2().getValue();
public void setValue1(Object v){
index.getInputValue1().setValue(v);
public void setValue2(Object v){
index.getInputValue2().setValue(v);
}and then call in the index backing:
doSomethingWithMyObject( new MyObjectW(this)); so it will access to the most actual values from user at the valueChangeEvent
But i really would like some way to execute my code called from the "valueChangeEvent" but after the model has been updated
so i dont need to wrap or implement PhaseListener
what do you think, what do you suggest, have any solution or a way to do what I'm trying?
thank you for your help...
Message was edited by:
akanewstedHello Frank, thanks for the response.
When you say
"If you need an updated object in this listener then you can update it from the value change listener as well"
you mean i can update the object by myself with the value from getNewValue()? or is there another way
to call to update the models at this time ?
I know i have the methods "getOldValue()" and "getNewValue()" in the "ValueChangeEvent" but what if i need
the actual value from the user in other control than the one that fires the event
example
Two inputs:
in the input1 the user enters some data
in the input2 when some data is entered it fires valueChangeListener (autosubmit=true)
in that case what if i need the value the user just entered in the input1 in the valueChangeListener of
the input2.
In general the app I'm working must do:
dynamically generate the controls in the form (inputs, selects etc)
Attach the control values to a model ( <af:inputText value=#{model.x}"/>
sometimes execute some script when a value change in a control (valueChangeListener)
those scripts uses the model (and needs to be an updated model)
script = " if (value2 = 'xyz') then value1='abc'; return true;";
if the model is not updated
the script will use old values and will be wrong
or if the script change some value in the model, when the update model phase occurs the value from
the script is lost.
that's why i need to work directly with the model and not the values in the ValueChangeEvent
Is there a way to use something like an action in the change of a control value?
that way the code will execute in the invoke application phase, can this be done ?
how i can execute code in the invoke application when a valueChangeEvent occurs ?
hope this help to explain more my situation.
Thank you for your help and time. -
AddPartialTarget causes valueChangeListener invoked multiple times
Hi All,
I am using JDev 11.1.1.6.0.
I have a problem with programmatic ppr using addPartialTarget method.
The scenario is as follows:
I have an af:table in which 2 of the columns include selectOneChoice in each: ( select1 and select2 ).
The values of select2 depends on select1. For example, select1 has countries, and select2 has cities of the selected country of select1.
So, in valueChangeListener of select1, based on the selected value, get the respective cities, put into the list used by select2. And after everything finished, refresh the select2 using AdfFacesContext.getCurrentInstance().addPartyTarget(this.getSelect2()).
The problem is that the valueChangeListener of select1 (countryChangeListener) is called multiple times. Then it shows NullPointerException pop-up in the ui. But I can't find the exception trace in my log. I found that it's not coming from the listener method when I debug.
Below is the jsff content:
+<af:column headerText="#{bindings.tableVO1.hints.Country.label}" id="c16">+
+<af:selectOneChoice label=""+
+value="#{row.bindings.Country.inputValue}"+
+valueChangeListener="#{backingBeanScope.myBean.countryChangeListener}"+
+autoSubmit="true"+
+id="soc1">+
+<f:selectItems value="#{pageFlowScope.countryList}"+
+id="si2"/>+
+</af:selectOneChoice>+
+</af:column>+
+<af:column headerText="#{bindings.tableVO1.hints.City.label}" id="c8">+
+<af:selectOneChoice label="" id="soc4"+
+value="#{row.bindings.City.inputValue}"+
+autoSubmit="true"+
+binding="#{backingBeanScope.myBean.socCity}">+
+<f:selectItems value="#{row.bindings.CityList.inputValue}"+
+id="si6"/>+
+</af:selectOneChoice>+
+</af:column>+
The problem also occurs for other select boxes in that table.
Although I solved it by using *partialTriggers=soc1* in city select box in jsff, it works (it refreshes the city select box and shows the values), I don't know why the programmatic refresh with addPartialTarget() is not working.
Can you all please help with that issue? Because I need to use addPartialTarget for other cases.
Thanks.
Best Regards,
cmosterHi,
there is no way in JSF to execute a value change listener multiple times and I spare myself the full life cycle explanation here. Because you use this in a table, how likely is it that the Value Change Listener is invoked for other rows of the table? Can you try setting the selectOneChoice valuePassThru property to true? My assumption is that upon rendering of the select lists you do change the underlying component value
Frank -
Matrix-like PKs based on three optional IN-constrained strings?
Hello,
I have a DB of actions that I want to represent. I want to model a number of actions as you know them from classic GUIs:
open
openFile
saveAs
exportToDirectory
reverseEngineerFromDatabase
As I analyzed the problem, I came to the conclusion, the keys above (which they ultimately are) have at least three parts:
1. an action: VARCHAR(20) CHECK (action IN ('open', 'save', 'export', 'reverseEngineer', ...))
2. a preposition: VARCHAR(4) CHECK (preposition IN ('as', 'to', 'from', ...))
3. a target: VARCHAR(20) CHECK (target IN ('file', 'directory', 'database', ...))
So the rule to construct the final key would be:
<action> + <preposition> + <target>
to model all sorts of combinations/permutations (forget about uppercasing the preposition and target if there for a moment).
As you can see from the strings, I have three dimensions of predefined values from which I construct the final key. Not every combination is possible, I want to represent valid combinations by an extra table having entries like:
INSERT INTO ValidActions ('open', '', '')
INSERT INTO ValidActions ('open', '', 'file')
INSERT INTO ValidActions ('save', 'as')
INSERT INTO ValidActions ('export', 'to', 'directory')
INSERT INTO ValidActions ('reverseEngineer', 'from', 'database')
My question is now:
How do I solve this, given that the PK is composed of ... PRIMARY KEY (action, preposition, target) ... and that an action has an OPTIONAL preposition and target? I have not come to a final decision, but I might relax the action to be optional, too, and then demand that either <action> OR <target> MUST be set.
How do I model matrix-like composed PKs consisting of a number of optionals? I currently see no other way of adding empty strings '' to the check constraint, however AFAIK Oracle does not make a difference between NULL and the empty string ''. How would such a solution look like?
I could use the final string as PK, but how do I make sure that string consists of the predefined ones only?
Karsten
PS: note action and target are actually two separate tables.What about using a model like this? I used surrogate keys because I wasn't sure if the ACTION, PREPOSITION and TARGET values were truly immutable. You could easily remove these from the model and use the respective columns as the PK for each table.
DROP TABLE ACT_PRE_TAR;
DROP TABLE ACTIONS;
CREATE TABLE ACTIONS
ACTION_ID NUMBER PRIMARY KEY
, ACTION VARCHAR2(15) NOT NULL
, CONSTRAINT ACTION#UNQ UNIQUE (ACTION)
INSERT INTO ACTIONS VALUES(1,'open');
INSERT INTO ACTIONS VALUES(2,'save');
INSERT INTO ACTIONS VALUES(3,'export');
INSERT INTO ACTIONS VALUES(4,'reverseEngineer');
DROP TABLE PREPOSITIONS;
CREATE TABLE PREPOSITIONS
PREPOSITION_ID NUMBER PRIMARY KEY
, PREPOSITION VARCHAR2(10) NOT NULL
, CONSTRAINT PREPOSITION#UNQ UNIQUE (PREPOSITION)
INSERT INTO PREPOSITIONS VALUES (1,'as');
INSERT INTO PREPOSITIONS VALUES (2,'to');
INSERT INTO PREPOSITIONS VALUES (3,'from');
DROP TABLE TARGETS;
CREATE TABLE TARGETS
TARGET_ID NUMBER PRIMARY KEY
, TARGET VARCHAR2(10) NOT NULL
, CONSTRAINT TARGETS#UNQ UNIQUE (TARGET)
INSERT INTO TARGETS VALUES (1,'file');
INSERT INTO TARGETS VALUES (2,'directory');
INSERT INTO TARGETS VALUES (3,'database');
CREATE TABLE ACT_PRE_TAR
ACTION_ID NUMBER REFERENCES ACTIONS(ACTION_ID)
, PREPOSITION_ID NUMBER REFERENCES PREPOSITIONS(PREPOSITION_ID)
, TARGET_ID NUMBER REFERENCES TARGETS(TARGET_ID)
, CONSTRAINT ACT_PRE_TAR#UNQ UNIQUE (ACTION_ID, PREPOSITION_ID, TARGET_ID)
);Based on your sample data the following result is produced:
SQL> SELECT ACTION
2 , PREPOSITION
3 , TARGET
4 FROM ACT_PRE_TAR
5 LEFT OUTER JOIN ACTIONS ON ACTIONS.ACTION_ID = ACT_PRE_TAR.ACTION_ID
6 LEFT OUTER JOIN PREPOSITIONS ON PREPOSITIONS.PREPOSITION_ID = ACT_PRE_TAR.PREPOSITION_ID
7 LEFT OUTER JOIN TARGETS ON TARGETS.TARGET_ID = ACT_PRE_TAR.TARGET_ID
8 /
ACTION PREPOSITIO TARGET
open
open file
save as
export to directory
reverseEngineer from database -
Some problems with af:table (new rows with presetting and autosubmit)
Hi, I'm working with an af:table, but I'm having some troubles.
Background:
Jdev 11.1.1.5.0
Firefox 6.0.2
In the Bounded Task flow:
ExecuteWithParams -> fragment < commit/rollback
ExecuteWithParams: Set a bind variable with a value from bpm payload for get only rows with that value.
In the fragment:
An af:table with a button CreateInsert (the new rows need to use the value of the payload in the hidden column, i don't know how do this, assign the value to the #{row.bindings.IdDistribution.inputValue}) [First problem]
The inputText of the af:table has the autoSubmit in true. The first time that I fill the cells I got this error in each entered value, after press the tab key.
ADF-FACES- 60097... ADF_FACES-60096:Server Exception during PPR, #n (where n is 1,2,3,4 for each cell). [Second problem]
When I press the Commit Button, all values from cells dissapears. And I got the message from validator that cells can't be null. [Third problem]
If I fill cells again, all work right. Validations, no errors ADF_FACES-60096 and a successful commit.
How I can solve these problems?
Thanks in advance.Hi,
you need to bind the value property of the selectOneRadio to the row variable. Say the button updates an attribute "q1" then the value property should point to #{row.bindings.q1.inputValue} assuming you use ADF and ADF BC. The question svary I assume., so you need to query thequestion for each row. For this reference a managed bean doe the f:selectItems and in the managed bean use the #{row} attribute to get a hold of the current rendered row (instance of JUCtrlHierNodeBinding if ADF is used. This has a method getRow() to obtain the Row object). The list then returns the answers to select from
Frank -
ValueChangeListener is not working.for disable property
valueChangeListener is not working for disable property with following details. Requirement is to enable to date if from to date is entered.
Field 1:
<af:inputDate value="#{bindings.PrintFromDate.inputValue}"
label="#{bindings.PrintFromDate.hints.label}"
required="#{bindings.PrintFromDate.hints.mandatory}"
shortDesc="#{bindings.PrintFromDate.hints.tooltip}"
id="id2" autoSubmit="true"
*valueChangeListener="#{reprintBean.enableToDate}">*
<f:validator binding="#{bindings.PrintFromDate.validator}"/>
<af:convertDateTime pattern="#{bindings.PrintFromDate.format}"/>
</af:inputDate>
<af:inputDate value="#{bindings.PrintToDate.inputValue}"
label="#{bindings.PrintToDate.hints.label}"
required="#{bindings.PrintToDate.hints.mandatory}"
shortDesc="#{bindings.PrintToDate.hints.tooltip}"
id="id1"
*disabled="#{!requestScope.enableToDate}"*
*partialTriggers="id2"*>
<f:validator binding="#{bindings.PrintToDate.validator}"/>
<af:convertDateTime pattern="#{bindings.PrintToDate.format}"/>
</af:inputDate>
public void enableToDate(ValueChangeEvent valueChangeEvent) {
System.out.println("IN enableToDate");
if (valueChangeEvent.getNewValue() != null) {
FacesContext context = FacesContext.getCurrentInstance();
System.out.println("Enable to Date");
context.getExternalContext().getRequestMap().put("enableToDate",true);
Please suggest me what is wrong on this.
Edited by: SrinivasA on Jan 28, 2011 5:34 PMI still not able to achive this. (null the to date value if the FromDate has changed)
<af:inputDate value="#{bindings.PrintFromDate.inputValue}"
label="#{bindings.PrintFromDate.hints.label}"
required="#{bindings.PrintFromDate.hints.mandatory}"
shortDesc="#{bindings.PrintFromDate.hints.tooltip}"
id="id2" autoSubmit="true"
*binding="#{reprintBean.fromDate}"*
*valueChangeListener="#{reprintBean.enableToDate}"*>
<f:validator binding="#{bindings.PrintFromDate.validator}"/>
<af:convertDateTime pattern="#{bindings.PrintFromDate.format}"/>
</af:inputDate>
<af:inputDate value="#{bindings.PrintToDate.inputValue}"
label="#{bindings.PrintToDate.hints.label}"
required="#{bindings.PrintToDate.hints.mandatory}"
shortDesc="#{bindings.PrintToDate.hints.tooltip}"
id="id1"
disabled="#{bindings.PrintFromDate.inputValue eq null}"
binding="#{reprintBean.toDate}"
*partialTriggers="id2">*
<f:validator binding="#{bindings.PrintToDate.validator}"/>
<af:convertDateTime pattern="#{bindings.PrintToDate.format}"/>
</af:inputDate>
Value change method:
public void enableToDate(ValueChangeEvent valueChangeEvent) {
*setToDate(null);*
This method is not able to reset the to date value to null. Please help to find the issue here.
Edited by: SrinivasA on Feb 1, 2011 5:12 PM -
ValueChangeListener in a Region
Hi,
I have added a valuechangelistener to a SelectOneChoice componenet in a region. At runtime, when i change the value in the lov, it doesnot call the method of valuechangelistener, where as if the add the same component with same valuechangelistner in the main page(container of the same region), the corresponding method is invoked.
So, I want to know if there is anything extra/special that is required to listen to valuechangelistner event in case of a region. Please reply asap.The scope of the managed bean is 'request'.
Yes, i have set autosubmit true. The same lines of codes are working fine for the main page but not for the region inside the page. -
ValueChangeListener in Radio Button not acting after first time
Hi,
I am using ADF-BC-JSF in Jdev 10.1.3.3. I have a page on which there are 2 radio buttons which show blank at first. As soon as a user selects a radio button, the valueChangeListener calls up a method in the backing bean that opens a dialog for the user. User enters some text in to the dialog and clicks OK after which the window closes. If the user clicks Cancel on the dialog page, the window is still closed but radio button value is reset to blank through javascript. the problem is that it works only first time. second time it tries to autosubmit but only the constructor of the backing bean is called and not the actual function to open the window. Following is the code snippet that may be helpful.
Radio Buttons
<af:selectOneRadio value="#{bindings.SP11WarrantDetailsViewMetallurgistReviewStatus.inputValue}"
layout="horizontal"
id="metallurgistRadioBtn"
autoSubmit="true"
valueChangeListener="#{UploadDownloadBean.exampleOpenDialog}"
disabled="#{ !UserInfo.metallurgist || bindings.SP11WarrantDetailsViewMetallurgistReviewStatus !=''}">
<af:validator binding="#{bindings.SP11WarrantDetailsViewMetallurgistReviewStatus.validator}"/>
<af:selectItem label="Approved" value="Approved"/>
<af:selectItem label="Rejected" value="Rejected"/>
</af:selectOneRadio>
Function to Open the Window
public void exampleOpenDialog(ValueChangeEvent valueChangeEvent)
// Add event code here...
FacesContext context = FacesContext.getCurrentInstance();
// Create the dialog UIViewRoot
ViewHandler viewHandler = context.getApplication().getViewHandler();
UIViewRoot dialog = viewHandler.createView(context,"/sp11/warrant/MetallurgistNotes.jspx");
HashMap properties = new HashMap();
AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
afContext.launchDialog(dialog,
null, // not launched from any component
null, // no particular parameters
true, //show in dialog
properties);
Javscript for resetting the Radiob button
function closeWindowOnCancel()
if(parent.window.opener.document.getElementById("notesValueHolder").value == '' )
parent.window.opener.document.getElementsByName("metallurgistRadioBtn")[0].checked = false;
parent.window.opener.document.getElementsByName("metallurgistRadioBtn")[1].checked = false;
Please suggest what can be the possible cause.
Regards,
NeerajHi,
I am using ADF-BC-JSF in Jdev 10.1.3.3. I have a page on which there are 2 radio buttons which show blank at first. As soon as a user selects a radio button, the valueChangeListener calls up a method in the backing bean that opens a dialog for the user. User enters some text in to the dialog and clicks OK after which the window closes. If the user clicks Cancel on the dialog page, the window is still closed but radio button value is reset to blank through javascript. the problem is that it works only first time. second time it tries to autosubmit but only the constructor of the backing bean is called and not the actual function to open the window. Following is the code snippet that may be helpful.
Radio Buttons
<af:selectOneRadio value="#{bindings.SP11WarrantDetailsViewMetallurgistReviewStatus.inputValue}"
layout="horizontal"
id="metallurgistRadioBtn"
autoSubmit="true"
valueChangeListener="#{UploadDownloadBean.exampleOpenDialog}"
disabled="#{ !UserInfo.metallurgist || bindings.SP11WarrantDetailsViewMetallurgistReviewStatus !=''}">
<af:validator binding="#{bindings.SP11WarrantDetailsViewMetallurgistReviewStatus.validator}"/>
<af:selectItem label="Approved" value="Approved"/>
<af:selectItem label="Rejected" value="Rejected"/>
</af:selectOneRadio>
Function to Open the Window
public void exampleOpenDialog(ValueChangeEvent valueChangeEvent)
// Add event code here...
FacesContext context = FacesContext.getCurrentInstance();
// Create the dialog UIViewRoot
ViewHandler viewHandler = context.getApplication().getViewHandler();
UIViewRoot dialog = viewHandler.createView(context,"/sp11/warrant/MetallurgistNotes.jspx");
HashMap properties = new HashMap();
AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
afContext.launchDialog(dialog,
null, // not launched from any component
null, // no particular parameters
true, //show in dialog
properties);
Javscript for resetting the Radiob button
function closeWindowOnCancel()
if(parent.window.opener.document.getElementById("notesValueHolder").value == '' )
parent.window.opener.document.getElementsByName("metallurgistRadioBtn")[0].checked = false;
parent.window.opener.document.getElementsByName("metallurgistRadioBtn")[1].checked = false;
Please suggest what can be the possible cause.
Regards,
Neeraj -
How to get row index of data table in the while ValueChangeListener fired?
Hi,
i have a data table in my page, which contains various components like inputText, selectOneChoice in each row.
i am invoking a method ValueChangeListener attribute of the selectOneChoice component. I have given the autoSubmit=true for this component.
<tr:selectOneChoice id="ratingModelType"
value="#{childRatio.ratingModelType}" binding="#{pageManager.form.bindRatioType}"
valueChangeListener="#{pageManager.form.onRatingModelTypeChange}" autoSubmit="true"
contentStyle="width:150px" required="#{!childRatio.disableChildRatioRatingModelType}"
requiredMessageDetail="#{appBundle['error.ratingModelTypeShouldNotBeEmpty']}">
<f:selectItems value="#{pageManager.catalog['Rating Model Type']}" />
<tr:selectOneChoice>In that method i want to fetch the map(with all updated values) relevant to the currently modified row of the table.
Since i am not using the selectionListener or any radio buttons in the page i am not able to get the row index of the table.
somebody please tell me how to get the row index of the table, while ValueChangeListener fired?
Thanks in advance.
SubbuHi niki,
Thank you so much. With your suggestion i got the result exactly what i want.
thanks again.
--subbu -
Cancel button on ADF popup does not work with AutoSubmit Fields
Hello,
I currently have a very simple form inside of and ADF popup. I the form contains one SelectManyListbox. Here's my issue.
Lets say my form contains option A, B, and C.
Okay I open the popup for the first time, and a select, A and B, and I click cancel. When I open the form again, I would expect no options to be selected. HOwever, that is not the case, the last options I selected, prior to hitting Cancel are still selected.
I was able to fix this issue by setting contentDelivery to "lazyUncached".. However, as soon as I set autoSubmit to "true", the behavior goes back to keeping the selections I made, even if I hit cancel.
Question :
How can tell the popup to deselect the items that were selected in the SelectManyListbox during the canceled operation of the popup, when autoSubmit is enabled? IN other words, if A and B were selected, and I hit cancel, when I open the popup again, I should see zero items selected in the list.
Regards,,.Here, is a sample that i have in my project.
<af:popup childCreation="deferred" autoCancel="disabled" id="p1"
binding="#{backing_dev_rma_cart_Details.showCartDetails}"
contentDelivery="lazyUncached">
<af:dialog id="d2" type="none"
title="#{userinterfaceBundle.MODIFY_CART_DETAILS}"
inlineStyle="font-size:small;" closeIconVisible="false">
<f:facet name="buttonBar"/>
<af:panelGroupLayout id="pgl33" layout="vertical">
<af:panelFormLayout id="pfl2" rows="4" maxColumns="1">
<af:panelLabelAndMessage label="#{userinterfaceBundle.SERIAL}"
id="plam1">
<af:outputText value="#{bindings.SerialNumber.inputValue}"
id="ot9"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{userinterfaceBundle.PART}"
id="plam2">
<af:outputText value="#{bindings.ItemNumber.inputValue}"
id="ot10"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.Description.hints.label}"
id="plam3">
<af:outputText value="#{bindings.Description.inputValue}"
id="ot12"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage id="plam12"
label="#{bindings.CustomerPo1.hints.label}"
rendered="#{pageFlowScope.RmaAttributesBean.categoryId == 'RET ONLY' ? false : true}">
<af:inputText value="#{bindings.CustomerPo1.inputValue}"
label="#{bindings.CustomerPo1.hints.label}"
columns="30" maximumLength="25"
shortDesc="#{bindings.CustomerPo1.hints.tooltip}"
id="it11" simple="true"
required="#{sessionScope.GlobalInfo.rmaPOreq == true ? true : false}"
rendered="#{pageFlowScope.RmaAttributesBean.categoryId == 'RET ONLY' ? false : true}">
<f:validator binding="#{bindings.CustomerPo1.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.TrailerNo1.hints.label}"
id="plam5">
<af:inputText value="#{bindings.TrailerNo1.inputValue}"
label="#{bindings.TrailerNo1.hints.label}"
required="#{bindings.TrailerNo1.hints.mandatory}"
columns="30" maximumLength="15"
shortDesc="#{bindings.TrailerNo1.hints.tooltip}"
id="it8" simple="true">
<f:validator binding="#{bindings.TrailerNo1.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage id="plam11"
label="#{userinterfaceBundle.REASON_FOR_RETURN_0}">
<af:selectOneChoice id="soc5" autoSubmit="true"
unselectedLabel="#{'--'} #{userinterfaceBundle.REASON_FOR_RETURN_0} #{'--'}"
valueChangeListener="#{backing_dev_rma_cart_Details.reasonForReturnValueChange}"
simple="true"
value="#{bindings.ProblemTypeId.inputValue}">
<af:forEach items="#{bindings.RmaProblemCodes.rangeSet}"
var="item">
<af:selectItem id="si4" value="#{item.Meaning}"
label="#{item.LookupCode}"/>
</af:forEach>
</af:selectOneChoice>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.CompanyNotes1.label}"
id="plam4"
showRequired="#{bindings.ProblemTypeId.inputValue eq 'OT'}"
partialTriggers="soc5">
<af:inputText value="#{bindings.CompanyNotes1.inputValue}"
label="#{bindings.CompanyNotes1.label}"
required="#{bindings.CompanyNotes1.hints.mandatory}"
columns="60" maximumLength="150"
shortDesc="#{bindings.CompanyNotes1.hints.tooltip}"
id="it9" simple="true" partialTriggers="soc5"
rows="2">
<f:validator binding="#{bindings.CompanyNotes1.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName1}"
id="plam6"
showRequired="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired1 == 'Y' ? true : false}"
rendered="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName1 != null}">
<af:inputText value="#{bindings.Attribute1.inputValue}"
label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName1}"
columns="60" maximumLength="150" rows="2"
shortDesc="#{bindings.Attribute1.hints.tooltip}"
required="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired1 == 'Y' ? true : false}"
id="it14" simple="true">
<f:validator binding="#{bindings.Attribute1.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName2}"
showRequired="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired2 == 'Y' ? true : false}"
rendered="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName2 != null}"
id="plam7">
<af:inputText value="#{bindings.Attribute2.inputValue}"
label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName2}"
columns="60" maximumLength="150" rows="2"
required="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired2 == 'Y' ? true : false}"
shortDesc="#{bindings.Attribute2.hints.tooltip}"
simple="true" id="it15">
<f:validator binding="#{bindings.Attribute2.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName3}"
showRequired="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired3 == 'Y' ? true : false}"
rendered="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName3 != null}"
id="plam8">
<af:inputText value="#{bindings.Attribute3.inputValue}"
label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName3}"
columns="60" maximumLength="150" rows="2"
shortDesc="#{bindings.Attribute3.hints.tooltip}"
required="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired3 == 'Y' ? true : false}"
simple="true" id="it16">
<f:validator binding="#{bindings.Attribute3.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName4}"
showRequired="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired4 == 'Y' ? true : false}"
rendered="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName4 != null}"
id="plam9">
<af:inputText value="#{bindings.Attribute4.inputValue}"
label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName4}"
columns="60" maximumLength="150" rows="2"
shortDesc="#{bindings.Attribute4.hints.tooltip}"
required="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired4 == 'Y' ? true : false}"
simple="true" id="it17">
<f:validator binding="#{bindings.Attribute4.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName5}"
showRequired="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired5 == 'Y' ? true : false}"
rendered="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName5 != null}"
id="plam10">
<af:inputText value="#{bindings.Attribute5.inputValue}"
label="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customName5}"
columns="60" maximumLength="150" rows="2"
shortDesc="#{bindings.Attribute5.hints.tooltip}"
required="#{pageFlowScope.RmaAttributesBean.rmaReturnType.customRequired5 == 'Y' ? true : false}"
simple="true" id="it18">
<f:validator binding="#{bindings.Attribute5.validator}"/>
</af:inputText>
</af:panelLabelAndMessage>
<f:facet name="footer"/>
</af:panelFormLayout>
<af:spacer width="10" height="10" id="s19"/>
<af:panelGroupLayout id="pgl40" layout="horizontal"
styleClass="AFStretchWidth">
<af:panelGroupLayout id="pgl41" layout="horizontal"
styleClass="AFStretchWidth">
*<af:commandButton text="#{userinterfaceBundle.CANCEL}"*
styleClass="Button2" id="cb8" immediate="true"
*actionListener="#{backing_dev_rma_cart_Details.showDetailsPopupCancel}">*
*<af:resetActionListener/>*
*</af:commandButton>*
</af:panelGroupLayout>
<af:panelGroupLayout id="pgl42" layout="horizontal" halign="end"
styleClass="AFStretchWidth">
<af:commandButton text="#{userinterfaceBundle.OK}" id="cb10"
partialSubmit="true"
actionListener="#{backing_dev_rma_cart_Details.okAction}"
icon="/iq/skin/images/CommandButtonIcon.png"
iconPosition="trailing"/>
</af:panelGroupLayout>
</af:panelGroupLayout>
</af:panelGroupLayout>
<af:spacer height="-25px" id="s20"/>
</af:dialog>
</af:popup> -
Facing the problem ValueChangeListener of the Drop Down List
Hi,
I am using the JDeveloper 10.1.3.5.0 and the JHeadStart 10.1.3.3.88. In my requirement, I am having three View Objects(V1,V2,V3). I need to create a page based on one VO(V1) displayed as table. In the screen, there are 6 columns. Three of them(C1,C2,C3) are having the static values( coming from the VO(V1) from which it has been built), and the others are, one column(C4) is displayed as the drop down list(for some of the rows, drop down list values are coming from the VO(V2), and for the others drop down list values are coming from the other VO(V3). The other column(C5) is a input text field, that is enabled or disabled based on the selected values from the drop down list column(C4). The column(C6) is a check box. Now, coming to the actual requirement, the rows are related to the papers. For each paper, there are 5 methods of studies. One of the method of study is SelfLearning (5th method of study), for this the drop down values are coming from the VO(V3), and for the other methods of studies(1 to 4), the drop down values are coming from the VO(V2). Now, for a user, based on the number of papers, the number of rows are displayed.(1 paper- 5 rows, 2 papers-10 rows like wise). Initially, drop down list is displaying the null values. When I change the value in the drop down list, I need the ValueChangeListener has to be called and it has to call the method in the bean. From the bean, the column(C5) has to be enabled or disabled. This is working fine for the inital 5 rows and 7,8,9,10 rows and 12,13,14,15 rows. But, the ValueChangeListener is not working for the rows 6 and 11. I used the debug concept,and I confirmed that the valueChangeListener is not getting called for the rows 6,11,16 rows.
C 1
C 2
C 3
C 4
C 5
C 6
P1
ABC
Study Method1
Drop Down list1
input text box
check box
P1
ABC
Study Method2
Drop Down list2
input text box
check box
P1
ABC
Study Method3
Drop Down list3
input text box
check box
P1
ABC
Study Method4
Drop Down list4
input text box
check box
P1
ABC
Study Method5
Drop Down list5
input text box
check box
P2
DEF
Study Method1
Drop Down list1
input text box
check box
P2
DEF
Study Method2
Drop Down list2
input text box
check box
P2
DEF
Study Method3
Drop Down list3
input text box
check box
P2
DEF
Study Method4
Drop Down list4
input text box
check box
P2
DEF
Study Method5
Drop Down list5
input text box
check boxThe problem gets solved. Actually, the problem is at the VO Query. The small modification in the query at the attribute p_id( C1 ) has solved the issue.
-
[Solved] Nested setActionListener not working correctly.
Hi,
I'm having a situation where I have to load some xml and display the values on the screen. The results can be filtered by selecting a value in a selectOneChoice component. Please consider the example below, which is a reproducible scenario, just to show the 'wrong' (?) behavior.
The ValueChange bean initialize some lists and handles the selection change of the selectOneChoice component on the .jspx page. The onValueChange method will 'filter' the data everytime a selection change. The filterItems method will clear the personItems list and add a new object to the list, depending on the selected value:
public class ValueChange {
private List someSelectItems;
private String selectedValue;
private List personItems;
private Person person1 = new Person("1", "Larry", "Ellison");
private Person person2 = new Person("2", "Bill", "Gates");
private Person person3 = new Person("3", "Steve", "Jobs");
public ValueChange() {
System.out.println(this.getClass() + " Init");
this.someSelectItems = new ArrayList();
someSelectItems.add(new SelectItem("1", "Oracle"));
someSelectItems.add(new SelectItem("2", "MicroSoft"));
someSelectItems.add(new SelectItem("3", "Apple"));
this.personItems = new ArrayList();
this.personItems.add(person1);
public List getSomeSelectItems() {
// Fill this list.
return someSelectItems;
public void onValueChange(ValueChangeEvent valueChangeEvent) {
System.out.println("Current Class: ValueChange - Current Method: onDocumentLanguageValueChange");
if (valueChangeEvent != null) {
String vValue = valueChangeEvent.getNewValue().toString();
filterItems(vValue);
public void setSelectedValue(String selectedValue) {
this.selectedValue = selectedValue;
public String getSelectedValue() {
return selectedValue;
private void filterItems(String pValue) {
this.personItems.clear();
if (pValue.equals("1")) {
this.personItems.add(person1);
} else if (pValue.equals("2")) {
this.personItems.add(person2);
} else if (pValue.equals("3")) {
this.personItems.add(person3);
public void setPersonItems(List personItems) {
this.personItems = personItems;
public List getPersonItems() {
return personItems;
}The person class is just a simple bean containing some attributes + getters and setters:
public class Person {
private String id;
private String firstname;
private String lastname;
public Person(String pId, String pFirstname, String pLastname) {
this.id = pId;
this.firstname = pFirstname;
this.lastname = pLastname;
public void setId(String id) {
this.id = id;
public String getId() {
return id;
public void setFirstname(String firstname) {
this.firstname = firstname;
public String getFirstname() {
return firstname;
public void setLastname(String lastname) {
this.lastname = lastname;
public String getLastname() {
return lastname;
}On the start page of the example, the selectOneChoice will be rendered + the data matching to the selected item. I'm using a commandLink to open a detail page. The commandLink contains a nested af:setActionListener which should set the whole current person instance to a sessionScope variable. (But his seems to fail.]
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces"
xmlns:afh="http://xmlns.oracle.com/adf/faces/html">
<jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=windows-1252"/>
<f:view>
<afh:html>
<afh:head title="myPage">
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252"/>
</afh:head>
<afh:body>
<h:form id="myPageForm">
<h:panelGrid>
<af:selectOneChoice id="selectValue" autoSubmit="true" value="1"
valueChangeListener="#{valueChange.onValueChange}">
<f:selectItems value="#{valueChange.someSelectItems}"/>
</af:selectOneChoice>
<af:panelList partialTriggers="selectValue">
<af:forEach items="#{valueChange.personItems}" var="person">
<af:commandLink text="#{person.firstname} (#{person.id})"
action="showdetail">
<af:setActionListener from="#{person}"
to="#{sessionScope.person}"/>
</af:commandLink>
</af:forEach>
</af:panelList>
</h:panelGrid>
</h:form>
</afh:body>
</afh:html>
</f:view>
</jsp:root>The detail page should just read the firstname of the person instance on sessionScope, but it always shows the same name.
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces"
xmlns:afh="http://xmlns.oracle.com/adf/faces/html">
<jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=windows-1252"/>
<f:view>
<afh:html>
<afh:head title="myDetailPage">
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252"/>
</afh:head>
<afh:body>
<h:form>
<af:panelForm maxColumns="1">
<af:outputText value="#{sessionScope.person.firstname}"/>
<af:commandLink text="Back" action="back"/>
</af:panelForm>
</h:form>
</afh:body>
</afh:html>
</f:view>
</jsp:root>
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config xmlns="http://java.sun.com/JSF/Configuration">
<managed-bean>
<managed-bean-name>valueChange</managed-bean-name>
<managed-bean-class>be.contribute.valuechange.view.beans.ValueChange</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<application>
<default-render-kit-id>oracle.adf.core</default-render-kit-id>
</application>
<navigation-rule>
<from-view-id>/myPage.jspx</from-view-id>
<navigation-case>
<from-outcome>showdetail</from-outcome>
<to-view-id>/myDetailPage.jspx</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/myDetailPage.jspx</from-view-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-view-id>/myPage.jspx</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>I can always send this sample application by mail, just drop a reply or send me a message (koen [dot] verhulst [at] contribute [dot] be )
JDeveloper 10.1.3.3
Thanks in advance,
Koen VerhulstIt seems that it has something to do with the fact that I set the value of the selectOneChoice to 1.
<af:selectOneChoice id="selectValue" autoSubmit="true" value="1"
valueChangeListener="#{valueChange.onValueChange}">
<f:selectItems value="#{valueChange.someSelectItems}"/>
</af:selectOneChoice>I modified the value attribute to:
value="#{valueChange.selectedValue}"Where selectedValue is an attribute in my ValueChange class, containing a default value. Getters and setters are also generated.
private String selectedValue = "1"When I run the application again, after making these changes, I'm able to pass the correct data to the detail page. But: as soons as I select the 'default value' in the selectOneChoice, no valueChange is detected and thus my data does not gets filtered.
Since the valueChange instance is a request-scoped bean, a value change is not detected because the current value equals the default value (question: am I right here?).
Setting the bean to session scope let the example fully works.
Although it works, I think it should be better to let the bean on request scope and stored a 'selected' value attribute on the sessionScope.
Thanks,
Koen Verhulst -
ADF valuechangeListener Problem
Hi,
I am facing problem with ADF selectonechoice valuechangeListener.
Problem is i have four valuechangeListeners. those are dependent List Boxes. If i perform action on one valuechangeListener all other VC 's also calling. due to this i am facing problems. how to prevent calling other VCs. why it is calling other VCS also. please reply me very urgent
Thanks
JyothiHi,
a value change listener fires for any value that has been changed in a form (assuming the component has a ValueChangeListener applied). So obviously in your case more than one field has been changed, which shouldn't be the case if autosubmit=true is used
Frank -
LOV value changes to first in list when using valueChangeListener
All,
I'm having a problem using a valueChangeListener with an af:inputListOfValues. The listener is firing properly but unless
I use the search popup to select the value it is changing the value back to the first row in the list.
If I try to type in a value it's just going to be changed back to the first row in the list.
I'm sure there's something simple that I'm missing. Any ideas? Thanks.
I am using JDev 11.1.2.2.0
Below is how the list is defined and the Java behind the listener:
<af:inputListOfValues id="workCenterEntryId"
popupTitle="Search and Select: #{bindings.WorkCenterEntry.hints.label}"
value="#{bindings.WorkCenterEntry.inputValue}"
label="#{bindings.WorkCenterEntry.hints.label}"
model="#{bindings.WorkCenterEntry.listOfValuesModel}"
required="#{bindings.WorkCenterEntry.hints.mandatory}"
columns="#{bindings.WorkCenterEntry.hints.displayWidth}"
shortDesc="#{bindings.WorkCenterEntry.hints.tooltip}"
binding="#{pageFlowScope.PalletBuildBackingBean.workCenterEntryId}" editable="always"
simple="false"
valueChangeListener="#{pageFlowScope.PalletBuildBackingBean.changeWorkCenter}" autoComplete="on" autoSubmit="true">
<f:validator binding="#{bindings.WorkCenterEntry.validator}"/>
<af:autoSuggestBehavior suggestedItems="#{bindings.WorkCenterEntry.suggestedItems}"/>
</af:inputListOfValues>
public void changeWorkCenter(ValueChangeEvent valueChangeEvent) {
FacesContext facesContext = FacesContext.getCurrentInstance();
valueChangeEvent.getComponent().processUpdates(facesContext.getCurrentInstance());
//More code to do other stuff
}Thanks for your response.
Here's what I tried:
1) I removed the value change listener and the problem still occurred.
2) I set AutoSubmit to false and the problem stopped. -
Blank entry removed from af:selectOneChoice drop down on valueChangeListene
I am using af:selectOneChoice component which is getting populated with values from DB. when the page is loaded first time, I can see one blank entry in this component. I have valueChangeListener set on this. when i change the value, the blank entry is removed.
Can anyone help me with the reason or how can i retain that blank entry.Hi I am using following code for jsp page:
<af:selectOneChoice id="xyz" valueChangeListener="#{abc.xyzChanged}" value="#{abc.strxyz}" autoSubmit="true" styleClass="formfield">
<f:selectItems value="#{abc.arrayList}"/>
</af:selectOneChoice>
Following is the code in BKB class which populates this drop down:
AttributeValuesDTO attributeValuesDTO =
(AttributeValuesDTO)attrList.get(i); //attrList is list of values fetched from DB
arrayList.add(
new SelectItem(
attributeValuesDTO.getAttributeValue(),
attributeValuesDTO.getAttributeValue()));
I think that adding an extra blank entry is feature of af:selectOneChoice (please correct me) however that extra blank entry is removed when i trigger an action on valueChangeListener for af:selectOneChoice.
Maybe you are looking for
-
Hi, I've just purchased Flash CS4 and tried the "Adobe Media Encoder CS4" that comes with it. When attempting to launch it, I get this (see attachement) error and the program doesn't launch. Anyone aware of the cause of this error ? How I could get i
-
Different balance showing in open items of foreign customer
hi, there is a problem with balance shown as open items (billing documents) of customers in foreign currency the open item list shown diff amt in INR while FBL5N shows the diff amt. what can be possible reasons for it., is the exchange rates at take
-
The iMac is hooked up to the amplifier, and is too far away for the atv to be plugged in as well. Any settings I can fiddle with?
-
Hello everyone, I have this system for a while: -intel q9550 -2x 2gb Adata 800mhz ddr2 -cooler master realpower 500w -nvidia gtx260 c216 -hitatchi 1tb 32mb -msi g31m3 v2 -cooler master centurion 5 Last week I tried to test some ram i still had. Befor
-
Regarding use of *(asterisk) in a variable
While going through a peice of code, I noticed a structure defined as *NAST. I am not sure what this means but it behaved the same way as a structure or work area would do in a program. Can anyone please explain what does the *(asterisk) stands for h