Discussions
Categories
- 197.2K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.8K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 555 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.4K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 468 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
Trigger a backing bean method after selection on select one choice

MiguelPerez
Member Posts: 35
Hi all,
I'm new to Jdeveloper 11g, and I'm trying to trigger a method after the user makes a selection on a "select one choice" (JSF page).
I have a method (backing bean) that reads the selection and executes a procedure that retrieves some data and fills that on Input Text A and B, unfortunately this is implemented using an af: button and I would like this method to trigger automatically after the user makes the selection without clicking the button. Can you help me?
Thanks,
Mike.
I'm new to Jdeveloper 11g, and I'm trying to trigger a method after the user makes a selection on a "select one choice" (JSF page).
I have a method (backing bean) that reads the selection and executes a procedure that retrieves some data and fills that on Input Text A and B, unfortunately this is implemented using an af: button and I would like this method to trigger automatically after the user makes the selection without clicking the button. Can you help me?
Thanks,
Mike.
Tagged:
Best Answer
-
use valueChangeEvent and set selectOneChoice autoSubmit="true"
public void selectOneChoice1_valueChangeListener(ValueChangeEvent valueChangeEvent) { if(valueChangeEvent.getNewValue() != null) ...... } }
<af:selectOneChoice ............. autoSubmit="true" valueChangeListener="#{backingBeanScope.backing_TestPage.selectOneChoice1_valueChangeListener}" </af:selectOneChoice>
Answers
-
use valueChangeEvent and set selectOneChoice autoSubmit="true"
public void selectOneChoice1_valueChangeListener(ValueChangeEvent valueChangeEvent) { if(valueChangeEvent.getNewValue() != null) ...... } }
<af:selectOneChoice ............. autoSubmit="true" valueChangeListener="#{backingBeanScope.backing_TestPage.selectOneChoice1_valueChangeListener}" </af:selectOneChoice>
-
Thanks for your response, your suggestion does what I asked, it fires the procedure but now the code does not work, for some reason the variable "clientListIndex" is null, but if I place the code in a method associated with a button it works. Any suggestion?
public void onChangeCliente(ValueChangeEvent valueChangeEvent) throws SQLException {
if(valueChangeEvent.getNewValue() != null){
DCBindingContainer dcBinding =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCControlBinding listControlBinding =
dcBinding.findCtrlBinding("NameSourceList");
FacesCtrlListBinding listBinding = (FacesCtrlListBinding)listControlBinding;
if (clientListIndex != null){
Row row = listBinding.getRowAtRangeIndex(Integer.valueOf(clienteListIndex));
String enquiryListCode = row.getAttribute("Cvecliente").toString();
}
else{
System.out.println("null value");
}
} -
are you trying to fetch the selected value from selectOneChoice or you are trying to retrieve an attribute value from the iterator?
if you only need selected value "valueChangeEvent.getNewValue()" would get it.
Set selectOneChoice valuePassThru="true".
Edited by: Puthanampatti on Jan 9, 2010 9:37 PM -
Hey thanks so much, "valueChangeEvent.getNewValue()" gets the Index of selected item on select one choice, so I replaced the variable clientListIndex for "valueChangeEvent.getNewValue()" and the code works perfectly, unfortunately there's another issue, inside that Listener there's a line like:
InputTextA.setNewValue(NewValue);
Where new value has the value retrieved by reading the value from the select one choice and then executing a query that uses it to retrieve a value from another table.
"NewValue" has the correct value, but the "setNewValue" is not working like if the inputText is not been refreshed, what's missing? I need to indicate that the inputTextA must be refreshed after making a selection on the select one choice?
Thanks so much. -
Got it,
I had to set the partialTriggers on inputTextA to point to the selectOneChoice.
Thanks so much.
This discussion has been closed.