SelectOneMenu valueChangeListener with onchange=

Can anyone provide some insight into what I'm getting when using both valueChangeListener with onchange="submit()"? Both are needed in my app to cause a form change when a selectOneMenu item is selected.
After the page is initially loaded and making a menu selection, the selected menu item does not show and no action occurs. Watching the backing bean code, the listen method is not even called. Everything works as expected the second time a menu selection is made.
When the onchange="submit() statement is removed, the first menu selection will show in the menu, but, of course, the action upon value change does not occur.
Now I understand that JSF performs lazy instantiation and wonder if this is involved. But the menu choices are available for selection after the page loads, it's the listen method that doesn't get called the first time.
This is my selectOneMenu code:
<h:selectOneMenu id="locationSelection"
  valueChangeListener="#{SelectBean.onLocationChange}"
  onchange="submit()" >
  <f:selectItems id="locationSelects" value="#{SelectBean.locationSelects}" >
</h:selectOneMenu>

Likely you misunderstood the valueChangeListener and you was expecting some client-side magic. Wrong. JSF is fully server-side and the valueChangeListener definies a server-side method which should be invoked if the form is being submitted. If you want to submit the form automatically on change of the selection, then you indeed need to add onchange="submit();" attribute, which just adds a piece of Javascript (client-side scripting language) defining a Javascript method to submit the form when the selection has changed.

Similar Messages

  • JSF selectOneMenu valueChangeListener not firing

    I am using JDeveloper 10.1.3.4.0
    I am trying to select a value from a list when that value is selected it will fire a valuechangelistener that will call another list that will be populated based on the selected value.
    The valuechangelistener never fires.
    Here is my selectonemenu:
    <h:selectOneMenu binding="#{backing_careerPreparation.selectOneMenu1}"
    id="selectOneMenu1" value="#{backing_careerPreparation.testvalue}"
    valueChangeListener="#{backing_careerPreparation.selectOneMenu1_valueChangeListener}"
    onchange="submit()">
    <f:selectItems value="#{backing_careerPreparation.allMItems}"
    binding="#{backing_careerPreparation.selectItems1}" id="selectItems1"/>
    </h:selectOneMenu>

    Hi twolf,
    I am testing this on JDev 11g and notice that the selectOneMenu component do not have a autoSubmit attribute.
    Are you using ADF Faces or Trinidad components? I've never used the selectOneMenu component but hopefully you can substitute it with the selectOneChoice component. You can then set the autoSubmit attribute to true and have the valueChangeListener event fire as soon as you select a different value.
    In your current case, the valueChangeListener do fire. Unfortunately, it doesn't fire immediately after selecting a different value. Try clicking a submit button or something that calls an action to the server. You will notice that the valueChangeListener does get fired then.
    Regards,
    Chan Kelwin

  • Help with OnChange in cfselect

    Hello
    I'm hoping somebody can help me.
    I am using cfform with "flash" format and what I am trying to
    do is open an edit form and requery the cfselect box onChange.
    Basically the form has a cfselect field at the top and when the
    cfselect field is changed I want the other fields on the form to be
    updated with the correct information.
    <cfformgroup type="horizontal" label="Catchment ID:">
    <cfselect enabled="yes" name="CatchmentID" tooltip="Enter
    Catchment ID" required="yes" message="Enter Catchment ID"
    multiple="no" query="getCMTQry" value="CatchmentID"
    selected="#getCMTQry.CatchmentID#">
    <option value="#getCMTQry.CatchmentID#"
    <cfif (isDefined("getCMTQry.CatchmentID")
    AND getCMTQry.CatchmentID
    EQ getCMTQry.CatchmentID)>
    </cfif>>
    </option>
    </cfselect>
    <cfinput type="text" name="CatchmentName"
    label="CatchmentName:" message="Enter Catchment Name" size="37"
    required="yes" tooltip="Enter Catchment Name">
    <cfinput type="text" name="CatchmentCostCentre"
    label="Cost Code:" value="#getCMTQry.CatchmentCostCentre#"
    tooltip="Enter Cost Code" size="10">
    </cfformgroup>
    Thank you in advance for any help.
    Diane

    What modem do you have?
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Tabular form with Popuv LOV doesn't work with onchange event

    Hi all.
    I have a problem with tabular forms, Popuv LOVs and javascript.
    I have created one tabular form, I want to put a value in "my_field" field when a user selects a new value from other field called "my_list", I have this code:
    <script type="text/javascript">
    function putValue(pThis)
        var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
        html_GetElement('f06_'+vRow).value = '0000';
    </script>and this for Element Attributes:
    onchange="putValue(this);"Everything works well when I choose "Display as Text Field", but if I change this option to "Display as Popup KEY LOV" or "Popup LOV" it doesn't work, I mean "my_field" stays without any value.
    I'm using Oracle Application Express Release 4.0 and Oracle 11g
    Please help.
    Regards.

    Hi Peter.
    Thanks, yes, in fact the position of my column changes, but it doesn't work even with the correct element, I have made a lot of proves and it seems that APEX constructs POPUPS LOVS in a different way and that's why "onchange" does not work.
    With this thread: Re: onchange not work on popup lov for a field on collection I have a half solution, It works for existing rows, but it doesn't for added rows.
    I have solved this problem calling a function that set the onchange event to every row when "ADD ROW" button is pressed, now it works without problems.
    Regards.
    Oscar.

  • SelectOneMenu/SelectItems with Date fields

    I have trying to create a list of dates (hh:mm a) using selectOneMenu and selectItems. I can get things to display fine, but when the form is submitted, I get an error message similar to: "Conversion Error setting value 'Tue Sep 21 00:00:43 CDT 2004' for 'null Converter'."
    My understanding of the selectitems tag in JSF is that the datatype for its value must be the same as the value for the corresponding selectOne component. I've also read that it is not necessary to explicity declare a converter in this case
    I've tried doing to same but declaring a converter. Doing that, however, I get a "Validation Error: {0}Value is not valid" which would seem to suggest that my datatypes are not matching up.
    I've listed the relevant code below. Could someone please take a look and see if I'm missing something or does JSF just not support what I am attempting? Thanks.
    I am using the following in my jsf page:
    <h:selectOneMenu id="toTime" value="#{data.toTime}">
         <f:selectItems value="#{data.timeSelection}"/>
    </h:selectOneMenu>
    data.toTime:
    public void setToTime(Date newToTime)
         toTime = newToTime;
    data.timeSelection:
    public List getTimeSelection() {
         List timeArray = new ArrayList();
         DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
         GregorianCalendar calTime = new GregorianCalendar();
         calTime.set(GregorianCalendar.HOUR, 12);
         calTime.set(GregorianCalendar.MINUTE, 00);
         calTime.set(GregorianCalendar.AM_PM, GregorianCalendar.PM);
         for(int i=0; i<48; i++)
              timeArray.add(new SelectItem(calTime.getTime(), dateFormat.format(calTime.getTime())));
              calTime.add(GregorianCalendar.MINUTE, 30);
         return timeArray;
    }

    I had to resort to using Strings instead of dates. I have a time-driven application (dates only, not time).
    I have formatted by selectOneMenu values to be yyyyMMdd strings. Within the backing beans, I have a method that takes the strings and parses these strings back to dates before I manipulate them within my bean.
    Kind of ugly, but it works.

  • Form with onchange function

    I want to give option like pay by credit card or check.
    If one select credit card in select option it opens credit card related form inputs/Check than check related form inputs before submiting form.
    I would start like
    <cfform action"" method=""Post>
    <cfselect name="paymenttype" query="test" display="paymenttype" value="paymenttype">
    <option value ="other">Other</>
    </select>
    <cfif form.paymenttype = "Credit Card">
    <cfinput type="Test" name="creditcomp">
    <cfelseif form.paymenttype = "check">
    <cfinput type="text" name="bankinfo">
    </cfif>
    <input type="submit" value="Submit"></cfform>
    I belive I need to use Java script onChange event but I never did Java script before, can any one help me on it?
    I have been using cfcase and submiting form at each and than made session variable to generate appropriate result but now I wanrt to do some change.

    For learning js, I recommend the book, Teach Yourself Javascript in 24 Hours.  It's how I learned.  There are also tutorials on webmonkey.
    For what you are trying to do specifcally, I would put the credit card and bank stuff in separate divs and use js to show and hide them.  Google "javascript show hide"  to find code samples.

  • SelectOneMenu and ValueChangeListener

    Hi All,
    I am a new user of JSF components. I've got a problem about getting the selected value from the selectedOneMenu component. I have 3 selectOneMenu box and each has valueChangeListener.
    I wanna get first selected id and get the second value according to the first selected id and so on.
    The frist value change listener submit and get the selected value.But when the second value change listener submit the value, the first selectOneMenu also submit the value, so the previous value is lost and return null cause of no selection in the first box.
    I 've separate these component to three separate forms . But when one of the ValueChangeListener is execute, the others also execute.
    So , How can I pass this problem..
    Here is my coding...
    <h:form id="form1">
                        <h:panelGrid columns="3">
                        <h:column><h:outputLabel value="Category L1 : " /> </h:column>
                   <h:column>
                             <h:selectOneMenu id="selectValue"
                                                      onchange="this.form.submit();"
                                                 immediate="true"
                                                 value="#{categoryBean.selectValue}"
                                                 valueChangeListener="#{categoryBean.item1Change}">
                                       <f:selectItems value="#{categoryBean.menuItem1}"/>
                             </h:selectOneMenu>
                        </h:column>     
                        <h:column></h:column>               
                        <h:column><h:outputLabel value="Description : " /></h:column>
                        <h:column><h:outputText value="test" /></h:column>
                        <h:column><h:commandButton action="" value="Add New" /></h:column>
                        </h:panelGrid>
                        <h:inputHidden value="#{categoryBean.tempValue}" />
                   </h:form>
                   <h:form id="form2">
                        <h:panelGrid columns="3">
                        <h:column><h:outputLabel value="Category L2 : " /> </h:column>
                   <h:column>
                             <h:selectOneMenu id="selectValue2"
                                                      onchange="this.form.submit();"
                                                      immediate="true"
                                                      value="#{categoryBean.selectValue2}"
                                                      valueChangeListener="#{categoryBean.item2Change}">
                                       <f:selectItems value="#{categoryBean.menuItem2}"/>
                             </h:selectOneMenu>
                        </h:column>     
                        <h:column></h:column>               
                        <h:column><h:outputLabel value="Description : " /></h:column>
                        <h:column><h:outputText value="test" /></h:column>
                        <h:column><h:commandButton action="" value="Add New" /></h:column>     
                        </h:panelGrid>
                   </h:form>     
                   <h:form id="form3">
                        <h:panelGrid columns="3">
                        <h:column><h:outputLabel value="Category L3 : " /> </h:column>
                   <h:column>
                             <h:selectOneMenu id="selectValue3"
                                                      onchange="this.form.submit();"
                                                 immediate="true"
                                                      value="#{categoryBean.selectValue3}"
                                                      valueChangeListener="#{categoryBean.item3Change}">
                                       <f:selectItems value="#{categoryBean.menuItem3}"/>
                             </h:selectOneMenu>
                        </h:column>     
                        <h:column></h:column>               
                        <h:column><h:outputLabel value="Description : " /></h:column>
                        <h:column><h:outputText value="test" /></h:column>
                        <h:column><h:commandButton action="" value="Add New" /></h:column>
                        </h:panelGrid>     
                   </h:form>          
         public void item1Change(ValueChangeEvent event) {
              Utils.log(getFacesContext(),"Win b kwa...1.........");
              PhaseId phaseId = event.getPhaseId();
              String oldValue = (String) event.getOldValue();
              String newValue = (String) event.getNewValue();
              this.tempValue = newValue;
              if (phaseId.equals(PhaseId.ANY_PHASE))
                   event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
                   event.queue();
              else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES))
              Utils.log(getFacesContext(),"New Value is......"+newValue );
              if(newValue == null){
                   logger.info("Next time win tar.....");
              else{
                   this.setSelectValue(newValue);
              Utils.log(getFacesContext(), "In L1 : Selected Value is..."+this.getSelectValue());
              this.menuItem2 = this.getCategoryList(this.getSelectValue());
              FacesContext context = FacesContext.getCurrentInstance();
              context.renderResponse();
    please help me.. thanks in advance...

    There's a few things...
    First, and foremost, is that you have two forms on the page. This is a bad idea with JSF. It tends to mess things up (although, some people may have gotten it to work right). You might want to find a way to have only one h:form tag per page. That shouldn't actually be too hard.
    Next, it looks like you set up your selectOneMenu tags properly. You have the valueChangeListener, immediate=true and a form submit onchange. Good!
    However, the valueChangeListener implementation is different than what I usually see. You're queueing up the event to fire in UPDATE_MODELS phase... This is strange. This will probably undo the fact that you put immediate="true" on your component in the first place.
    My suggestion is not to manipulate the phases this way, for your particular problem. Instead, get the new value and set the selected value (without retrieving the phaseId). Then call facesContext.renderResponse() at the end of your valueChangeListener implementation. Something like this:
    public void item1Change(ValueChangeEvent event) {
        String newValue = (String) event.getNewValue();
        if(newValue == null){
            logger.info("Next time win tar.....");
        else{
             this.setSelectValue(newValue);
        Utils.log(getFacesContext(), "In L1 : Selected Value is..."+this.getSelectValue());
        //What's this?
        this.menuItem2 = this.getCategoryList(this.getSelectValue());
        FacesContext context = FacesContext.getCurrentInstance();
        context.renderResponse();
    }Start there. There may be a few more problems.
    CowKing

  • How to use onChange with edittext?

    Hi,
    This is how I'd like my script to work:
    In the first window, the user fills a few edittext-boxes with numbers. Clicking OK, a second window appears, where the previously entered values and results of calculations based on said numbers are displayed.
    Dismissing the second dialog with OK, another script from the same folder is started which receives the variables from the second window. The second menu has a back button which directs the user back to the first window.
    Would this be possible? I'm just beginning to script, so any help would be very appreciated.
    var value1;
    var value2;
    var value3;
    var value4;
    Win1();
    function Win1() {
        var win1 = new Window("palette", "Window 1",[200,100,700,340]);
        win1.editPanel = win1.add("panel", [25,15,476,140], "Edit");
        win1.editPanel.add("statictext", [15,20,255,35], "Width:");
        win1.editPanel.editA = win1.editPanel.add("edittext", [225,20,270,40], "120",);
        win1.editPanel.editA.onChange = function () {this.value = this.text};
        value1 = win1.editPanel.editA.value;
        win1.editPanel.add("statictext", [15,40,255,55], "Height:");
        win1.editPanel.editB = win1.editPanel.add("edittext", [225,40,270,60], "120",);
        win1.editPanel.editB.onChange = function () {this.value = this.text};
        value2 = win1.editPanel.editB.value;
        win1.editPanel.add("statictext", [15,60,255,80], "Multiplier Width:");
        win1.editPanel.editC = win1.editPanel.add("edittext", [225,60,270,80], "2",);
        win1.editPanel.editC.onChange = function () {this.value = this.text};
        value3 = win1.editPanel.editC.value;
        win1.editPanel.add("statictext", [15,80,255,100], "Multiplier Height:");
        win1.editPanel.editD = win1.editPanel.add("edittext", [225,80,270,100], "2",);
        win1.editPanel.editD.onChange = function () {this.text = this.value};
        value4 = win1.editPanel.editD.value;
        win1.okBtn = win1.add("button", [155,187,245,5],"OK");
        win1.cancelBtn = win1.add("button", [260, 187, 350, 5],"Cancel");
        win1.okBtn.onClick = function() {
                win2.show();
                win1.close();
        win1.cancelBtn.onClick = function() {
            win1.close();
        win1.show();
        return value1;
        return value2;
        return value3;
        return value4;
    var value5 = value1*value3;
    var value6 = value2*value4;
    //function Win2() {
        var win2 = new Window("palette", "Window 2",[200,100,700,340]);
        win2.controlPanel = win2.add("panel", [25,15,470,170], "Control");
        win2.controlPanel.add("statictext", [15,20,255,40], "Width:"+value1+"");
        win2.controlPanel.add("statictext", [15,40,255,60], "Height:"+value2+"");
        win2.controlPanel.add("statictext", [15,60,255,80], "Multiplier Width:"+value3+"");
        win2.controlPanel.add("statictext", [15,80,255,100], "Multiplier Height:"+value4+"");
        win2.controlPanel.add("statictext", [15,100,255,120], "Total Width:"+value5+"");
        win2.controlPanel.add("statictext", [15,120,255,140], "Total Height:"+value6+"");
        win2.okBtn = win2.add("button", [155,187,245,5],"OK");
        win2.backBtn = win2.add("button", [260, 187, 350, 5],"Back");
        win2.cancelBtn = win2.add("button", [365, 187, 455, 5],"Cancel");
        win2.okBtn.onClick = function() {
                win2.close();
        win2.cancelBtn.onClick = function() {
            win2.close();
            win1.show();
        win2.backBtn.onClick = function() {
            win2.close();
    //    win2.show();

    Hi Andrea,
    First you made some confusing and mistake
    Keep in mind , that dialogbox are unsynchronisious.. i explain (i try , i'm not expert)
    1) you prepare your first dialogbox
    - here a panel
    - add 'edittext' box with value
    2) you prepare your second dialogbox
    - here a panel
    - add 'edittext' box with your variable from first dialogbox, but at this time, dialogbox isn't running so value=undefined
    3) you call first dialbox
    Finally, you need consider your second dialogbox as embed in onClick function, because when onClick will be invoqued, value(s) will be really present.
    I hope i was clarly or not..
    Now your code:
    for statictext and editext use .text (and NOT value) to assign or capture the "value", value is for status of for exemple checkbox => checkbox.value is true or false
    win1.editPanel.editA = win1.editPanel.add("edittext", [225,20,270,40],"120",);
    win1.editPanel.editA.onChange = function () {this.value = this.text};
    value1 = win1.editPanel.editA.value;
    your onChange is useless, because if there are changes, of course the "value" will be changed, useless to re-assign a changed value
    but you could have used onChange to calculate and show the result , without create a second dialogbox (see the second script , lastest)
    Now check this your revised script:
    function Win1() {
        var win1 = new Window("palette", "Window 1",[200,100,700,340]);
        win1.editPanel = win1.add("panel", [25,15,476,140], "Edit");
        win1.editPanel.add("statictext", [15,20,255,35], "Width:");
        win1.editPanel.editA = win1.editPanel.add("edittext", [225,20,270,40]);
         win1.editPanel.editA.text=120;
        win1.editPanel.add("statictext", [15,40,255,55], "Height:");
        win1.editPanel.editB = win1.editPanel.add("edittext", [225,40,270,60]);
         win1.editPanel.editB.text=120;   
        win1.editPanel.add("statictext", [15,60,255,80], "Multiplier Width:");
        win1.editPanel.editC = win1.editPanel.add("edittext", [225,60,270,80]);
        win1.editPanel.editC.text=2;   
        win1.editPanel.add("statictext", [15,80,255,100], "Multiplier Height:");
        win1.editPanel.editD = win1.editPanel.add("edittext", [225,80,270,100]);
        win1.editPanel.editD.text=2;
        win1.okBtn = win1.add("button", [155,187,245,5],"OK");
        win1.cancelBtn = win1.add("button", [260, 187, 350, 5],"Cancel");
        win1.okBtn.onClick = function() {
              var value5 = win1.editPanel.editA.text*win1.editPanel.editC.text;
              var value6 = win1.editPanel.editB.text*win1.editPanel.editD.text;
         ///////////////// create win2 /////////////
        var win2 = new Window("palette", "Window 2",[200,100,700,340]);
        win2.controlPanel = win2.add("panel", [25,15,470,170], "Control");
        win2.controlPanel.add("statictext", [15,20,255,40], "Width:"+win1.editPanel.editA.text+"");  
        win2.controlPanel.add("statictext", [15,40,255,60], "Height:"+win1.editPanel.editB.text+"");  
        win2.controlPanel.add("statictext", [15,60,255,80], "Multiplier Width:"+win1.editPanel.editC.text+"");  
        win2.controlPanel.add("statictext", [15,80,255,100], "Multiplier Height:"+win1.editPanel.editD.text+"");
        win2.controlPanel.add("statictext", [15,100,255,120], "Total Width:"+value5+"");
        win2.controlPanel.add("statictext", [15,120,255,140], "Total Height:"+value6+"");
        win2.okBtn = win2.add("button", [155,187,245,5],"OK");
        win2.backBtn = win2.add("button", [260, 187, 350, 5],"Back");
        win2.cancelBtn = win2.add("button", [365, 187, 455, 5],"Cancel");
        win2.okBtn.onClick = function() {win2.close();    };
        win2.cancelBtn.onClick = function() {win2.close();win1.show();    };
        win2.backBtn.onClick = function() {win2.close(); win1.show()   };
        //////////////////// end of win2 ////////////////////      
                win2.show();
                win1.close();
        win1.cancelBtn.onClick = function() {      win1.close();    };
        win1.show();
        return win1;
    Win1();
    The same, but shorter with onChange and only one dialogbox
    function Win1() {
        var win1 = new Window("palette", "Window 1");
        win1.editPanel = win1.add("panel", undefined, "Edit");
        win1.editPanel.add("statictext", undefined, "Width:");
        win1.editPanel.editA = win1.editPanel.add("edittext", undefined);
         win1.editPanel.editA.text=1200;
        win1.editPanel.add("statictext", undefined, "Height:");
        win1.editPanel.editB = win1.editPanel.add("edittext", undefined);
         win1.editPanel.editB.text=1200;   
        win1.editPanel.add("statictext", undefined, "Multiplier Width:");
        win1.editPanel.editC = win1.editPanel.add("edittext", undefined);
        win1.editPanel.editC.text=20;   
        win1.editPanel.add("statictext", undefined, "Multiplier Height:");
        win1.editPanel.editD = win1.editPanel.add("edittext", undefined);
        win1.editPanel.editD.text=20;
         win1.editPanel.add("statictext", undefined, "Result Width:");
        win1.editPanel.editE = win1.editPanel.add("edittext", undefined);
        win1.editPanel.editE.text=24000;   
        win1.editPanel.add("statictext", undefined, "Result Height:");
        win1.editPanel.editF = win1.editPanel.add("edittext", undefined);
        win1.editPanel.editF.text=24000;
        win1.cancelBtn = win1.add("button", undefined,"Cancel");
        function calcul(){         
              win1.editPanel.editE.text = win1.editPanel.editA.text*win1.editPanel.editC.text;
              win1.editPanel.editF.text = win1.editPanel.editB.text*win1.editPanel.editD.text;
         win1.editPanel.editA.onChange=
         win1.editPanel.editB.onChange=
         win1.editPanel.editC.onChange=
         win1.editPanel.editD.onChange= function() {  calcul() };
        win1.cancelBtn.onClick = function() {      win1.close();    };
        win1.show();
        return win1;
    Win1();
    Regards, art.chrome
    Message was edited by: artchrome (added a shorter script)

  • JSF h:selectOneMenu weird stuff

    Hello, I'm a newbie.
    I have a working ComboBox (selectOneMenu) in one panelGroup the contents of which are populated in .java file from a DB. (the code is not mine, it's a big project). The panelGroups are opened one at a time depending which menu is selected. I want the same combobox in the other panelGroup, so I copy the code
    <h:selectOneMenu valueChangeListener="#{administration_analysis_report_user.changeAnalysisReport}" binding="#{administration_analysis_report_user.analysisReport}" onchange="submit();">
        <f:selectItems value="#{administration_analysis_report_user.analysisReportList}" />
    </h:selectOneMenu>to other panelGroup, but it does not appear (does not generate any code).
    Which can be the problem (i tried putting IDs, removing these bindings/actionListeners, but nothing helped). But as I rename selectOneMenu into selectManyListbox, the list appears.
    Thanks for guidelines!
    sledge

    Thanks for a quick reply!
    The problem is that I don't get the cloned (copy->pasted) comboBox (selectOneMenu) after I copy/paste the code. If i rewrite it into listbox, everything works fine even without altering .java code, which is not even the case here.
    in an associated java file everyting is as you'd described:
    private HtmlSelectOneMenu analysisReport; // + getter + setter
    the only weird thing is that I cannot have this selectOneMenu working in another panelGroup. The weird thing to tell of all this is as if the original comboBox is somehow bound to the panelGroup it is in, and any copy/pastes to elsewhere stop it from working. But I cannot trace that bound anyhow.
    Once again -- there's nothing to do with object type mismatches.
                                            <h:panelGroup id="analysis_report_contents">
                                                    <h:form id="form">
                                                            <h:panelGrid styleClass="spaceAbove" columns="1">
                                                                    <t:panelGroup>
                                                                            <h:outputText value="#{m['administration_analysis_report_user_report']}: " />
    <!-- this generates no code -->
                                                                            <h:selectOneMenu valueChangeListener="#{administration_analysis_report_user.changeAnalysisReport}" binding="#{administration_analysis_report_user.analysisReport}" onchange="submit();">
                                                                                    <f:selectItems value="#{administration_analysis_report_user.analysisReportList}" />
                                                                            </h:selectOneMenu>
    <!-- this works fine even without changing the object types in .java file; but I need a combobox, not listbox -->
                                                                            <h:selectMultipleListBox valueChangeListener="#{administration_analysis_report_user.changeAnalysisReport}" binding="#{administration_analysis_report_user.analysisReport}" onchange="submit();">                                                                </t:panelGroup>
                                                                                     <f:selectItems value="#{administration_analysis_report_user.analysisReportList}" />
                                                                            </h:selectMultipleListBox>
                                                           </h:panelGrid>
    <!-- ... -->
                                            </h:form>
                                            </h:panelGroup>
    <!-- here it works fine, I copy paste the selectOneMenu to the above panelGroup from here: -->
                                            <h:panelGroup id="analysis_report_security">
                                                    <h:outputText styleClass="summaryHeader" value="#{m['administration_analysis_report_user_header']}" />
                                                    <h:form>
                                                            <h:panelGrid styleClass="spaceAbove" columns="1">
                                                                    <t:panelGroup>
                                                                            <h:outputText value="#{m['administration_analysis_report_user_report']}: " />
                                                                            <h:selectOneMenu valueChangeListener="#{administration_analysis_report_user.changeAnalysisReport}" binding="#{administration_analysis_report_user.analysisReport}" onchange="submit();">
                                                                                    <f:selectItems value="#{administration_analysis_report_user.analysisReportList}" />
                                                                            </h:selectOneMenu>
                                                                    </t:panelGroup>
                                                            </h:panelGrid>
    <!-- ... -->

  • SelectOneMenu disables itself after facesMessage

    Hello All,
    I have been working this for a while now and not really sure how to get around it. I have a SelectOneMenu populated with selectItems inside a form. The required attribute is set to true and the requiredMessage attribute is set to "Please select a position". The form elements (including the selectOneMenu) is nested inside a rich:modalPanel.
    What happens is that since the selectOneMenu is required the messages fire--the expected behavior BUT the selectOneMenu for some reason also disables itself. Now, I am thinking that this "disabled" quality of the selectOneMenu has something to do with the component loosing it value and/or selectItems values--not sure though. The applicable code is listed below:
    <rich:modalPanel id="groupsAddPanel" width="500" height="450" style="background-color: #EEEECB;" 
    binding="# {membersHandler.addNewMembers}">
                    <f:facet name="header">
                        <h:panelGroup>
                            <h:outputText id="groupsAddPanelHeaderText"
                                          value="#{membersHandler.addMembersHeaderLabel}"/>
                        </h:panelGroup>
                    </f:facet>
                    <f:facet name="controls">
                        <h:panelGroup>
                            <h:graphicImage value="/images/close.png"
                                            style="cursor:pointer" id="hidelinkAddGroups"/>
                            <rich:componentControl for="groupsAddPanel"
                        attachTo="hidelinkAddGroups"
                                                    operation="hide" event="onclick"/>
                        </h:panelGroup>
                    </f:facet>                          
                    <a4j:region id="groupsAddRegion">
                        <a4j:form id="groupsAddForm" ajaxSubmit="true" rendered="true" status="groupAddStatusId" >
                            <h:panelGroup id="groupsAddPanelGroup" rendered="true" >
                                <table cellpadding="3" cellspacing="0" border="0" id="addGroupsTable"
                                       style="background-color: #EEEECB;" >
                                    <tr>
                                        <td class="groupsTdLables">
                                            <h:outputText id="posLblGroupsAddForm" value="Position: "/>
                                        </td>
                                        <td colspan="3" class="addGroupsInputs">
                                            <h:selectOneMenu id="positionDropDown"                                                         
                                                             valueChangeListener="#{membersHandler.positionSelected}"
    required="true"
                                                             requiredMessage=" Please select a position!"
                                                             value="#{membersHandler.dirtyMembers.srpMemLuId}"
                                                             binding="#{membersHandler.membPosHtmlSelectOneMenu}">
                                                <f:selectItems value="#{membersHandler.generalSelectItem}"
                                                               binding="#{membersHandler.membPosSelectItems}"/>
                                                <a4j:support event="onchange" reRender="positionDropDown"/>
                                            </h:selectOneMenu>                                       
                                        </td>
                                    </tr>
                                </table>                  
                                <h:panelGrid id="groupsAddPanelButtonsPanelGrid" columns="3" style="text-align:center; width:100%;">
                                    <a4j:commandButton id="saveLinkAddGroupsPanel"  value="#{srpBundle.hlinkSave}" 
                                                       styleClass="buttons01" status="groupAddStatusId"
                                                       rendered="true" action="#{membersHandler.saveNewRow}"
                                                       onclick="this.value='Processing...'; this.disabled=true;"
                                                       oncomplete="windowclose();">
                                        <a4j:support event="onclick" reRender="addGroupsTable"/>
                                    </a4j:commandButton>
                                    <rich:spacer id="blankspaceId" width="200px;" />
                                    <a4j:commandButton id="cancelLinkAddGroupsPanel"  value="#{srpBundle.hlinkCancel}"
                                                       styleClass="buttons01" status="groupAddStatusId"
                                                       rendered="true" reRender="facStudRotcForm" immediate="true">
                                        <rich:componentControl id="richCmptCntrlCancelAddGroupsPanel" for="groupsAddPanel"                          attachTo="cancelLinkAddGroupsPanel"      
                        operation="hide" event="onclick"/>
                                    </a4j:commandButton>
                                </h:panelGrid>
                            </h:panelGroup>
                        </a4j:form>
                        <a4j:status id="groupAddStatusId" startText="One Moment Please..."
                   stopText="Ready!" style="text-align: center; font-size: 14px; font-weight: bold;"/>
                    </a4j:region>
                    <rich:messages id="richMessagesBaseForm2"
                                   binding="#{membersHandler.htmlRichMessages}"
                                   style="text-align: left"
                                   passedLabel="Data is allowed to be stored."
                                   layout="list">
                        <f:facet id="richMessagesBaseFormFacetHeader" name="header">
                            <h:outputText id="baseFormOutPutText" value="Entered Data Status:"></h:outputText>
                        </f:facet>
                        <f:facet  id="richMessagesBaseFormFacetPassed" name="passedMarker">
                            <h:graphicImage id="baseFormImagePassed" value="/images/passed.gif"/>
                        </f:facet>
                        <f:facet  id="richMessagesBaseFormFacetError" name="errorMarker">
                            <h:graphicImage id="baseFormImageError" value="/images/error.gif"/>
                        </f:facet>
                    </rich:messages>
    </rich:modalPanel>I didn't see a need to post the valueChangeListern method because according to my debugger I never get there. The require=true attribute
    doesn't let the valueChangeListerner fire.
    Any ideas?

    place your select one menu in Ajax enable ajaxouputpanel and assign id to that component and re render the ajaxoutputpanel i hope it will resolve your problem.
    AjaxOutputPanel
    like the code.
    <a4j:outputPanel layout="block" id="positionDropDown">
    <h:selectOneMenu  valueChangeListener="#{membersHandler.positionSelected}"
    required="true"
                                                             requiredMessage=" Please select a position!"
                                                             value="#{membersHandler.dirtyMembers.srpMemLuId}"
                                                             binding="#{membersHandler.membPosHtmlSelectOneMenu}">
                                                <f:selectItems value="#{membersHandler.generalSelectItem}"
                                                               binding="#{membersHandler.membPosSelectItems}"/>
                                                <a4j:support event="onchange" reRender="positionDropDown"/>
                                            </h:selectOneMenu>
    </a4j:outputPanel>Edited by: [email protected] on Sep 16, 2008 11:55 PM

  • I had succeeded in navigation while i used [b]valueChangeListener[/b]

    After learning in the forum,
    i had succeeded in navigation while i used the attribute valueChangeListener in the tag h:selectOneMenu. Cheers. Here is my some codes about this:
    in # faces-navigation.xml #
    <navigation-rule>
              <from-view-id>/jsp/Renraku/C01Choice.jsp</from-view-id>
              <navigation-case>
                   <from-outcome>error</from-outcome>
                   <to-view-id>/jsp/login/error.jsp</to-view-id>
              </navigation-case>
              <navigation-case>
                   <from-outcome>success</from-outcome>
                   <to-view-id>/jsp/Renraku/C01Choice.jsp</to-view-id>
              </navigation-case>
    </navigation-rule>in # c01ChoiceBean.jsp #
    <h:selectOneMenu rendered="true" onchange="submit()" binding="#{c01ChoiceBean.selected}" valueChangeListener="#{c01ChoiceBean.doSearch}" immediate="true" style="width:200;">
                                       <f:selectItems value="#{c01ChoiceBean.options}"/>
                                  </h:selectOneMenu>in # c01ChoiceBean.java #
    public void doSearch(ValueChangeEvent event){
                FacesContext ctx = FacesContext.getCurrentInstance();
                try{
                   String groupId = (String)selected.getValue();
                   C01ChoiceDao dao = new C01ChoiceDao();
                   ArrayList userGroup = new ArrayList();               
                   userGroup = dao.getUser(groupId);
                   C01ChoiceBean c01ChoiceBean = (C01ChoiceBean)FacesServletUtils.getManagedBean(BeanNames.C01CHOICEBEAN);
                   c01ChoiceBean.setUserGroupListLeft(userGroup);
                   c01ChoiceBean.setUserGroupListRight(new ArrayList());
                   FacesServletUtils.setManagedBeanInSession(BeanNames.C01CHOICEBEAN,c01ChoiceBean);
                  ctx.getApplication().getNavigationHandler().handleNavigation(ctx, null, "success");
             catch(Exception ce){
                 ctx.getApplication().getNavigationHandler().handleNavigation(ctx, null, "error");
           }At first, it didn't work. i had been confused. Suddenly, it workd whitout any modification in long time. God save me. Oho, oho!

    As far as I know, [https://addons.mozilla.org/firefox/addon/classicthemerestorer/ the Classic Theme Restorer add-on] is the only way move the Reload button outside the address bar.
    # Install [https://addons.mozilla.org/firefox/addon/classicthemerestorer/ Classic Theme Restorer] and restart Firefox when prompted.
    # Open the Add-ons Manager (Ctrl+Shift+A; Mac: Command+Shift+A), then the Extensions category.
    # Next to Classic Theme Restorer, click the Options button.
    # On the Main tab, make sure "Movable back-forward button" and "Hide urlbars stop & reload buttons" are checked. You might also want to check "Combine stop & reload buttons". Close the options window when done.
    # Right-click an empty area of the tab bar and choose Customize.
    # Drag the Back/Forward, Stop and Reload buttons onto the navigation toolbar.
    # Click the Exit Customize button in the lower right corner when done.
    That being said, I should point out that you can reload pages in other ways.
    * Right-click any tab and choose Reload.
    * Right-click an empty area of the page and choose Reload.
    * Press F5.
    * Press Ctrl+R (Mac: Command+R).

  • Parent child relationship for h:selectOneMenu

    I am trying to create a h:selectOneMenu child list when the parent list is selected I want to use that selection as the value to build my child list with.
    But when I use the valueChangeListener it does not fire.
    So I am wondering if there is another way to build the child list based on the selection.
    I am using jDeveloper 10.1.3.4.0.4270, and i am only using JSF HTML components.
    Thanks
    Tyler

    Re: JSF selectOneMenu valueChangeListener not firing

  • Dynamic h:dataTable with embedded h:selectBooleanCheckbox(es) & view state

    Hi
    I hope someone can help me. I'm trying to create a form somewhat like the one in allEvents.xhtml of the Virtual Trainer app in Ed Burns' JSF 2.0 book. My form is similar in that it uses an h:dataTable to display a set of rows that include an h:selectBooleanCheckbox. (In my case, the row also contains an h:inputText). So far, that's all working fine.
    However, to complicate things, I've added an <h:selectOneMenu immediate="true" onchange="this.form.submit()"/> to change the contents of the datatable based on the menu selection. This is where things start to go wrong. When the menu selection changes, the dataTable does update to show the new set of rows. However, there seems to be some state in the dataTable or the view that does not get reset when the content changes.
    This causes a couple of problems: When the initial menu selection is 'noSelectionOption' and the dataTable value is 'an empty list', then the menu selection changes, none of the input items' values are set when the form is submitted. It seems like dataTable remembered that the list is empty, and subsituting a longer list is confusing it. Or, is it the view that's confused because the number of input elements changed?
    When I initialize the menu selection to one that has a non-empty dataTable list associated with it, things work as desired, but changing menu selections again confuse things (checkboxes remain checked, rows beyond those in the initial list don't get their values set.) Hopefully, you're still with me.
    It seems like this should be do-able. What am I missing? I've boiled it down to a simple example. I appreciate your help. The code:
    selectitems.xhtml
    <html xmlns="http://www.w3.org/1999/xhtml"
    >
        <ui:fragment rendered="#{!empty facesContext.messageList}">
          <h:messages layout="list" />
        </ui:fragment>
        <h:form>
    <div>
          <h:outputLabel for="categories">Category</h:outputLabel>
          <h:selectOneMenu id="categories" tabindex="3" value="#{optionsBean.category}" immediate="true" onchange="this.form.submit()" required="true">
            <f:selectItem itemValue="#{optionsBean.categoryNotSelected}" itemLabel="-- select one --" noSelectionOption="true" />
            <f:selectItems value="#{optionsBean.categories}" />
          </h:selectOneMenu>
    <div>
    </div>
          <h:outputLabel for="optionlist">Options</h:outputLabel>
          <h:dataTable immediate="true" id="optionlist" value="#{optionsBean.optionData}" var="data" binding="#{optionsBean.optionTable}">
            <h:column>
              <h:selectBooleanCheckbox id="ctselect" value="#{optionsBean.optionSelected}" />
              <h:outputLabel for="ctselect" value="#{data.label}" />
              <ui:fragment rendered="#{!empty data.detailLabel}">
                <h:inputText id="ctdetail" value="#{optionsBean.optionDetail}" />
                <h:outputLabel for="ctdetail" value="#{data.detailLabel}" />
              </ui:fragment>
            </h:column>
          </h:dataTable>
    </div>
        <h:commandButton action="#{optionsBean.submit}" type="submit" value="Submit"/>
         <h:button outcome="/index" value="Cancel" />
        </h:form>
    </html>OptionsBean.java
    package org.example;
    @ManagedBean
    public class OptionsBean
      int category = getCategoryNotSelected();
      private UIData optionTable;
      private DataModel<OptionTableRow> optionData = new ListDataModel<OptionTableRow>();
      private List<OptionTableRow> optionList = new ArrayList<OptionTableRow>();
      // static data for demonstration use
      private static List<SelectItem> categories = new ArrayList<SelectItem>();
      private static List<OptionTableRow> sizeOptionList = new ArrayList<OptionTableRow>();
      private static List<OptionTableRow> colorOptionList = new ArrayList<OptionTableRow>();
      private static List<OptionTableRow> styleOptionList = new ArrayList<OptionTableRow>();
      static
        OptionsBean o = new OptionsBean();
        sizeOptionList.add( o.new OptionTableRow( "small" ) );
        sizeOptionList.add( o.new OptionTableRow( "medium" ) );
        sizeOptionList.add( o.new OptionTableRow( "large" ) );
        sizeOptionList.add( o.new OptionTableRow( "other", "specify" ) );
        colorOptionList.add( o.new OptionTableRow( "red" ) );
        colorOptionList.add( o.new OptionTableRow( "green" ) );
        colorOptionList.add( o.new OptionTableRow( "blue" ) );
        colorOptionList.add( o.new OptionTableRow( "other", "specify" ) );
        styleOptionList.add( o.new OptionTableRow( "modern" ) );
        styleOptionList.add( o.new OptionTableRow( "traditional" ) );
        categories.add( new SelectItem( 1, "size" ) );
        categories.add( new SelectItem( 2, "color" ) );
        categories.add( new SelectItem( 3, "style" ) );
      public OptionsBean()
    //    setCategory( getCategoryNotSelected() );
        setCategory( 3 );
      public int getCategoryNotSelected()
        return -1;
      public boolean isOptionSelected()
        OptionTableRow row = (OptionTableRow) optionTable.getRowData();
        return row.selected;
      public void setOptionSelected( boolean selected )
        OptionTableRow row = (OptionTableRow) optionTable.getRowData();
        row.selected = selected;
      public String getOptionDetail()
        OptionTableRow row = (OptionTableRow) optionTable.getRowData();
        return row.detail;
      public void setOptionDetail( String detail )
        OptionTableRow row = (OptionTableRow) optionTable.getRowData();
        row.detail = detail;
      public String submit()
        int count = 0;
        for ( OptionTableRow opt : optionList )
          if ( opt.selected )
            count++;
        if ( count == 0 )
          FacesContext fc = FacesContext.getCurrentInstance();
          fc.addMessage( null, new FacesMessage( FacesMessage.SEVERITY_ERROR, "At least one option must be selected", null ) );
          return null;
        return "showoptions";
      public DataModel<OptionTableRow> getOptionData()
        optionData = new ListDataModel<OptionTableRow>( optionList );
        optionData.setRowIndex( -1 );
        return optionData;
      public void setCategory( int category )
        this.category = category;
        switch ( category )
          case 1:
            optionList = sizeOptionList;
            break;
          case 2:
            optionList = colorOptionList;
            break;
          case 3:
            optionList = styleOptionList;
            break;
      public class OptionTableRow
        private String label;
        private boolean selected = false;
        private String detailLabel = null;
        private String detail = null;
        public OptionTableRow() { }
        public OptionTableRow( String label )
          this.label = label;
        public OptionTableRow( String label, String detailLabel )
          this.label = label;
          this.detailLabel = detailLabel;
    // getters and setters omitted for brevity
      }

    flyeminent wrote:
    However in my particular case, the dynamic list is not known until the user choose to view a table. Then move the call from the getter to the bean's action method.

  • OnChange for a selectItem

    I am new to JSF ( done a lot of struts/JSTL though )
    I am trying to get a dataTable displayed with onChange event from a dropdown menu.I have been succesful with a submit button but I guess things are different in the JSF world when it comes to JS events like onChange .Do I need "listeners" for this.Could I get an example...

    Not sure but I think it's something like:
    JSP:
    <h:selectOneRadio value="#{mgdBean2.currentSearchType}"
    immediate="true" onclick="this.form.submit()"
    valueChangeListener="#{mgdBean2.changeSearchType}">
    <f:selectItems value="#{mgdBean2.allSearchTypes}"/>
    </h:selectOneRadio>
    Bean:
    public void changeSearchType(ValueChangeEvent evt)
              String newSearchTypeValue = evt.getNewValue().toString();
              if (newSearchTypeValue.equals(KEYWORD_VAL))
                   setKeywordSearch(true);
              else if (newSearchTypeValue.equals(AUTHOR_VAL))
                   setAuthorSearch(true);
              FacesContext.getCurrentInstance().renderResponse();
    Hope it's of some use, it's straight out of some training material we have lying around!

  • Conserving filename with upload via portal form into blob type

    Hi
    I have a little question. Is there any chance to conserve a filename, which was uploaded into blob column via portal form and then create link for this file with the same name?
    null

    Vlasta,
    You certanly can save the original filename in your form, to do that you will need to add a FILENAME varchar2 column to your table and write a simple Javascript (search this forum for examples) to copy the fileselect value with onChange event. So, when you submit the form with your file the original name will be stored in you table.
    Thanks,
    Dmitry

Maybe you are looking for

  • Output error in smart forms

    I am facing a typical problem in rendering output from smart forms to pdf. The program was working fine before , now after some patch application the output is not comming , it shows " A Drawing Error Occured" Regards

  • ICloud on Windows 7 - RIP

    Here are just a few of the problems I've encountered in the last 3 days trying to get iCloud to work on Windows 7. Initial Setup - deleted approximately 30% of of my Contacts. - failed repeatedly on step 5 with an error: Apple Outlook DAV Config has

  • How to select tool when url is wrong?

    In order to watch some vid streaming, I loaded the vshare plugin. It does what it's supposed to do but also has inserted a toolbar (which I can not display) but when I enter a URL that can't be found, I get a page from vshare. Can I; how? change this

  • Audigy 2 ZS Diagnostics Won't Run After Driver Upd

    Diagnostics worked fine until I updated mu Audigy 2 ZS drivers to the latest version; 02.08.0004. I'm running XP Pro SP2. Followed the Creative update instructions to the letter. Downloaded the update package to my machine. Nothing else was running w

  • I have CS2 or 3 and want to upgrade

    I have CS2 or 3 and want to upgrade the Photoshop to the latest possilbe version. I do not want the CC version since I live in an area with sketchy and sometimes non-existent internet. How and where do I download this program.