SelectOneMenu as editable

Hi all,
I have a problem..
I am having a selectOneMenu in my webpage with some pre-populated data, I also need to allow the user to modify and add new value using the selectOneMenu component...
Please help me in this....

Hi Suresh,
Just insert a module SET_CURSOR in the PBO event of the table maintanence of the custom table.
MODULE SET_CURSOR.
  Loop at screen.
     if field1 is initial.
        SET CURSOR FIELD field1.
    elseif field2 is initial.
        SET CURSOR FIELD field2.
    endif.
  Endloop.
ENDMODULE.
Reward if useful.
Thanks,
Muthu.

Similar Messages

  • Need help with SelectOneMenu in a HtmlDataTable: Default Values

    Hello again,
    I have an DataTable in my jsp and 1 of the columns need to be a dropdown.
    Further, I also need the dropdown defaulted to whatever data that is currently in the datatable.
    I can get the dropdown data to display, however I cannot get it to default to a value in each row.
    So far I've got the following:
    jsp:
    <h:dataTable id="dataTable" binding="#{AddSponsors.projectDepartmentsDataTable}" value="#{AddSponsors.projectDepartments}" var="projectDepartments"  border="1" >
    <h:column>
       <f:facet name="header" >
          <h:outputText value="Department" styleClass="labelcell"/>     
       </f:facet>
       <h:selectOneMenu value="#{projectDepartments.deptCode}">
          <f:selectItems value="#{AddSponsors.selectItemsDepartment}" />
       </h:selectOneMenu>
    </h:column>**Note that AddSponsors.projectDepartments is a list of the object AddSponsorsDTO.
    AddSponsorsDTO:
    public class AddSponsorsDTO implements java.io.Serializable{
       private String deptCode;
       private String deptName;
       private Double percentAllocation;
      //getters and setters for the above
    }session scoped backing bean:
    I have the dropdown populated fine like this:
    //getter for the dropdown
    public List<SelectItem> getSelectItemsDepartment() {
       fillSelectItemsDepartment();
       return selectItemsDepartment;
    //fill the dropdown
    public void fillSelectItemsDepartment(){
       TbDepartment t;
       List l = this.tbDepartmentDAO.findAll();
       selectItemsDepartment = new ArrayList<SelectItem>();
       for (Iterator i = l.iterator(); i.hasNext();){
          t = (TbDepartment) i.next();
          selectItemsDepartment.add(new SelectItem(t.getDeptCode(), t.getDeptName()));
    }How is an item selected in the dropdown. Let's say programatically for example? By deptCode?
    Am I missing anything here?
    Thanks!
    Nick
    Edited by: nicksan on Nov 15, 2007 4:14 PM

    I revisited that page and now I understand a bit more clearly.
    The key for me was the LinkedHashedMap and the get() method.
    As you suggested, I also created a DTO to store the key and value.
    Then I populate the Map like this:
    selectListDTOMap = new LinkedHashMap<String, SelectListDTO>();
    for (Iterator i = l.iterator(); i.hasNext();){
       t = (TbDepartment) i.next();
       selectListDTOMap.put(t.getDeptCode(),  new SelectListDTO(t.getDeptCode(), t.getDeptName()));
    }Then I've got another method that populates the actual SelectItems.
    selectItemsDepartment = new ArrayList<SelectItem>();
    List<SelectListDTO> list = new ArrayList<SelectListDTO>(selectListDTOMap.values());
    for(SelectListDTO dto : list){
       selectItemsDepartment.add(new SelectItem(dto.getKey(), dto.getValue()));
    }I also have a valueChangeListener like this:
    public void selectItemChanged(ValueChangeEvent event){
       String newValue = (String) event.getNewValue();
       SelectListDTO dto = (SelectListDTO) selectListDTOMap.get((String)event.getNewValue());
       AddSponsorsDTO s = (AddSponsorsDTO) projectDepartmentsDataTable.getRowData();
       s.setDeptCode(dto.getKey());
       s.setDeptName(dto.getValue());
       s.setDataItemStatus(AddSponsorsDTO.NewModified);
       //set the new data to the datatable data          
       projectDepartments.set(projectDepartmentsDataTable.getRowIndex(), s);
    }Makes sense?

  • How to set the default item showed in a h:selectonemenu

    I need to show the second, or the third, and on so.
    i tried some ways to set the default item showed in it, but failed.
    i had tried the attribute value, but it stiil showed the first item.
    Can u help me?
    in the JSP
    <h:selectOneMenu id = "companyName" rendered="true" binding="#{j03CMSyainAddBean.selectCompany}" style="width:150">
           <f:selectItems value="#{j03CMSyainAddBean.companyList2}"/>
    </h:selectOneMenu>in the back BEAN
    private UISelectOne selectCompany;
    private ArrayList companyList2;In the ArrayList companyList2, there are several selectItems.
    Thanks
    George

    Sanjeev K Sharma wrote:
    and without messing with /boot/grub/grub.cfg  ?
    I need this so that new kernels show up but do not change the default boot kernel
    Is there a way to do it by file name instead of position within the menuentry / submenu list?
    I found some ubuntu and fedora sugestions but all by position, none by name
    AND how to set the kdump kernel as the default?
    Arch is putting this kernel under a submenu - would this pose problems for setting it as the default?
    In /etc/default/grub you can use the name of your entry you wish to use as default
    GRUB_DEFAULT='Arch Linux, with Linux core repo kernel'
    You can tell grub to stop using submenus by doing:
    GRUB_DISABLE_SUBMENU=y
    Or you can just make a purely custom menuentry in /etc/grub.d/40_custom if you'd like:
    menuentry "Other Linux" {
    linux <KERNEL IMAGE HERE>
    initrd <INITRD IMAGE HERE>
    EDIT: /etc/grub/default -> /etc/default/grub
    Last edited by Slabity (2015-04-07 11:16:22)

  • How to internationalize h:selectOneMenu and select items.

    I'm trying to have a web app in different languages which is working fine.
    my question is, here I post an example of selectOnemenu
                   <h:selectOneMenu value="#{user.gender}">
                   <f:selectItem itemValue="1" itemLabel="#{dropdown.male}"/>
                   <f:selectItem itemValue="2" itemLabel="#{dropdown.female}"/>
                   </h:selectOneMenu>
    where it said "dropdown.male" this valude is coming from properties file from the application rather than database or list. I did this because the user can change the language by selecting the appropriate properties file
    ex: dropdown_de.properties for Germen Language or dropdown_it.properties for italian.
    if the user select female from the dropdown, when I go in editing mode, I want the the first one or the selected one to be first. how I can do that? if it was array or list i could have done it but from the properties file its kind of difficult.
    I could not find this solution from books or online. I hope some one has the answer for me.
    code example is greatly welcome.
    Thank you in advance.

    harddisk wrote:
    if the user select female from the dropdown, when I go in editing mode, I want the the first one or the selected one to be first. how I can do that? if it was array or list i could have done it but from the properties file its kind of difficult.
    I could not find this solution from books or online. I hope some one has the answer for me.I don't clearly understand the problem, but I assume that you want to preselect an item? If so, then you should be presetting the value behind #{user.gender} to 2.

  • h:selectOneMenu and "value" attribute

    I have an issue with the <h:selectOneMenu> tag. On a page I've written, the select items are populated with a <f:selectItems> tag that is bound to a managed bean property with session scope which queries from a database table for the select items. The <h:selectOneMenu> value property - which determines the item that is selected - is bound to a property of a managed bean that has session scope.
    There is a button on the screen that causes navigation to a new screen. On this screen, the user can add an entry to the database table from which the <f:selectItems> are populated. The event handler for the second screen adds a new item to the database table and sets the property on the managed bean to that determines which item is selected on the previous screen to this new value.
    The problem I have is that the new item is added to the list, but it is not the selected item when the first screen is navigated back to. If I view the HTML code generated, none of the <option> tags contains the "SELECTED" property. Strangely, if I enter a new item that is less - alphabetically - than the existing items, it will be selected, but if I add an item that falls into the middle of the list or the end of the list alphabetically, it is not selected.
    I don't know what to do here. Is there some requirement about sorting the collection that backs the <f:selecteditems> facet? This doesn't seem likely since I've tried various sorts to figure this out and nothing has worked. Is there a known bug setting the value property of <h:selectOneMenu>?
    Any ideas?

    When your setting the value for the <h:selectOneMenu> make sure its a string!
    Here is a simple example
    (.jsp page)
    <h:selectOneMenu id="locationID" value="2">
       <f:selectItems value="#{LocationList.itemList}"/>
    </h:selectOneMenu>
    (HTML Code that gets generated from the .jsp page
    <select id="edit:locationID" name="edit:locationID" size="1">
       <option value="1">Anoka</option>
       <option value="2"  selected>MSO</option>
    </select>

  • Error  while working with JSF SelectOneMenu and JSTL forEach Tag

    Hello,
    I have set up few things in ArrayList in my contextListener as like below
    ServletContext context=event.getServletContext();
    List list=new ArrayList();
    list1.add("Honda");
    list1.add("Mazda");
    list1.add("eClipse");
    context.setAttribute("carList", list)
    I just wanted to display the list in my JSF page, I wrote the below statements in my JSF page
    <h:selectOneMenu value="{com.carSelection}">
    <c:forEach var="car" items="${applicationScope.carList}" >
    <f:selectItem itemLabel="${car}"/>
    </c:forEach>
    </h:selectOneMenu>
    I am getting the below exception
    org.apache.jasper.JasperException: /pages/protected/cmt/index.jsp(23,2) According to TLD or attribute directive in tag file, attribute itemLabel does not accept any expressions
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
    org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1124)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:819)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator
    Could some one help to solve this error (Or) How should I display from my applicationScope list into MenuItems ?
    Edited by: Saravvij on Apr 9, 2008 8:37 PM
    Edited by: Saravvij on Apr 9, 2008 8:38 PM

    Hi,
    get your original message source from SXMB_MONI
    (right click - view source ) then paste your message to your message mapping (Test Tab) in the Integration Repository
    test your mapping and check if it's ok
    Regards,
    michal

  • Want to state maintain of h:selectOneMenu

    Hi,
    i have some filter option with <h:selectOneMenu>
    when i add some thing to with selected value from <h:selectOneMenu> ,*want to come with the same value after adding* .
    Edited by: My_Problems on Jun 17, 2008 9:23 AM

    Hi,
    <h:outputText id="order1" value="Filter on cd/dvd type"/>   <h:selectOneMenu id="mymenu1" >
                        <f:selectItem itemValue="" id="val1" itemLabel=""/>
                        <f:selectItem itemValue="1" id="val2" itemLabel="*Licence*"/>
                        <f:selectItem itemValue="0" id="val3" itemLabel="Open source"/>
                   </h:selectOneMenu>
    I have filter option in main view page
    1-Licence
    2-Open source
    suppose i filter with Licence get all result with Licence cd/dvd type
    after that i add a new cd/dvd ,after adding when i came back to the main view page i want to same selected state of
    <h:selectOneMenu > that was Licence,

  • Help needed with SelectOneMenu

    Hi,
    I have a quick, silly question. I'm trying to use a DataTable which has a column populated with a SelectOneMenu for each row. All the SelectOneMenu's contain the same selectable items. My problem is that when ever you try to change the selection of any of the menus they keep their previous value, except for the one in the last row of the table. When the value of the last menu is changed it then changes the value for all menus.
    Here is my sample code:
    <h:dataTable border="1" value="#{bulkBean.bulk}" var="items">
                             <h:column>
                                  <h:selectOneMenu onchange="submit()" binding="#{bulkBean.type2}"
                                       value="#{bulkTypeBean.selectItem}">
                                       <f:selectItems value="#{bulkTypeBean.bulkTypes}" />
                                  </h:selectOneMenu>
                                  <f:facet name="header">
                                       <h:outputText value="Bulk Type" />
                                  </f:facet>
                             </h:column>
                        </h:dataTable>Edited by: MrMiagi on Feb 20, 2008 12:36 AM

    You should bind the selectOneMenu value to a property of the actual row object (the object behind var="items"), not to a property of a single generic bean which would be overwritten everytime on each row iteration. So replace value="#{bulkTypeBean.selectItem}"byvalue="#{items.selectItem}"

  • ConvertDateTime with selectOneMenu

    I'm attempting to populate a drop down box with date values. I'd like to use the convertDateTime feature but I'm having trouble. I have a method in a bean MyBean which is called to populate the selection items. I also have an instance variable that is a Date type that I would like to be set when the user makes a selection from the drop down. My assumption was that I could use the convert feature to go back and forth, parse and format between String and Date types.
    @ManagedBean
    public class MyBean {
         private Date date;
         public void setDate( String value ) {
              System.out.println("Setting date as String value is " + value);
         public void setDate(Date value) {
              System.out.println("Setting date as " + value.toString());
              this.date = value;
         public Date getDate() {
              if ( date == null ) return new Date();
              else return date;
         public List<SelectItem> getDateList() {
              Calendar calendar = Calendar.getInstance();
              List<SelectItem> options = new ArrayList<SelectItem>();
              for( int i = 0; i < 4; i++ ) {
                   calendar.set(Calendar.MONTH, i);
                   options.add( new SelectItem( calendar.getTime(), calendar.getTime().toString()));
              return options;
         public String getSomething() {
              System.out.println("Get Something - Date starts as " + this.date);
    <h:selectOneMenu id="selectionDay" value="#{myBean.date}" required="true" requiredMessage="* Required">
         <f:selectItems value="#{myBean.dateList}" />
         <f:convertDateTime type="date" dateStyle="long" />
         <f:ajax render="@form" execute="#{myBean.something}" />
    </h:selectOneMenu>I see that the drop down is populated with four values of dates and that they appear in the standard toString format. But when I make a selection I see a validation error - j_idt41:selectionDay: Validation Error: Value is not valid
    Can anyone advise as to what I should use the converter for or am I just to rely upon SimpleDateFormat in my bean? Thanks for any help.
    ETA -
    Just found a related discussion here...
    http://www.thatsjava.com/java-web-tier-apis/18216/
    I tried to use the code provided but I'm still seeing the validation error on the JSF page. The solution offered isn't working for me. I tried using the exact code offered there.
    Edited by: nantucket on Jun 20, 2011 10:36 AM

    Based upon the feedback I found here..
    http://seamframework.org/Community/ValueIsNotValidWhenUsingSselectItemsAndHselectOneMenu
    I managed to resolve this by including type="both" with the conversion tag.

  • Can't initilize selectOneMenu from bean value

    Hello,
    I don't seem to understand the proper way to initilize a select list.
    I have the following code on my edit.jsp page. The selectOneMenu
    is always initilized to the first of the select item while the value
    outputText is correct and initialized to the name of the guest.
    The context of the code snippet is that the application can select
    a booking and then edit on a seperate.
    The value to be edited is stored in MainBean.ebook
    I can see that my converter is not being called on loading the edit page.
    Why not?
    Thanks..
    <h:outputText value="Guest"/>
    <h:selectOneMenu value="#{MainBean.ebook.guest}"
         converter="GuestConverter"
    required="true"
    onchange="this.form.submit()" >
    <f:selectItems value="#{MainBean.selectGuests}" />
    </h:selectOneMenu>
    <h:outputText value="Guest Name"/>
    <h:outputText id="user" value="#{MainBean.ebook.guest.name}"/>
    // in MainBean.java
    public List getSelectGuests() {
         return JSFHelper.getSelectList(gb.getGuestList());
    public class JSFHelper {
    public static List getSelectList (Collection c) {
    ArrayList list = new ArrayList (c.size());
    Iterator itr = c.iterator();
    while (itr.hasNext()) {
    Object x = itr.next();
    list.add (new SelectItem (x, x.toString()));
    return list;
    }

    I found the solution.
    I am going to answer my own question to document the problem.
    I was populating the listbox with object of type Guest.
    The initialization code was calling equals on the guest type
    which by default uses object identity. In my case I redefined the
    Guest.equals to compare equal when the string was equal.
    i..e
    class Guest {
    boolean equals(Object o ) {
    if (o instanceof Guest) return o.toString().equals (toString());
    }

  • 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

  • Dynamically selecting value from SelectOneMenu

    I have a form where all employee records are displayed.
    On clicking Edit button for a particular employee,his details are displayed in another form.
    I am not able to select his name dynamically from h:SelectOneMenu .
    How to do it???????????? any ideas

    I have the h:selectOneMenu code as follows,
    <h:selectOneMenu binding="#{backing_edit_adslot.slot_name}" id="slot_name"
    value="#{backing_Adslotbean.slot_id}">
    <f:selectItems value="#{ED.slot_list}"
    binding="#{backing_edit_adslot.selectItems2}"
    id="selectItems2"/>
    </h:selectOneMenu>

  • SelectOneListbox looks like SelectOneMenu

    Hello togehter!
    I have a SelectOneListbox with a Bean.
    Everything works fine, just when I load the page the SelectOneLIstbox looks like a a SelectOneMenu.
    Is this a bug??
    Is there a way to fix this except with initializing it with mir than one items.
    Thanks a lot.

    I believe the original poster was referring to the "Download Now" button and the "Downloads" tab at http://developers.sun.com/javadb/index.jsp
    Edited by: 940787 on Jun 14, 2012 10:07 AM

  • 3 selectOneMenu

    Hi,
    I am trying to operate 3 selectOneMenus, whenever one is changed, others will updated.
    If firstmenu's value is changed, the second one is updated but third one is not.
    For example, first menu is country menu, second is state menu, third is city menu.
    i.e. user selects US on the first one, and TX in the second, and Texas in the third. When user changes firstmenu selection to Germany, second menu is updated also. But third one is not updated, it is still Texas selected.
    <h:selectOneMenu value="#{exampleBean.selectedCountry}"
       onchange="this.form.submit();" id="countyMenu" required="true" >
       <f:selectItem itemValue="0" itemLabel="Select a Country"/>
       <f:selectItems value="#{exampleBean.allCountries}" />
    </h:selectOneMenu>
    <h:selectOneMenu id="stateMenu" value="#{exampleBean.selectedState}"
       onchange="this.form.submit();" required="true" >
       <f:selectItem itemValue="0" itemLabel="Select a state/>
       <f:selectItems value="#{exampleBean.states}" />
    </h:selectOneMenu>
    <h:selectOneMenu id="cityMenu" value="#{exampleBean.selectedCity}"
        onchange="this.form.submit();">
       <f:selectItem itemValue="0" itemLabel="Select a city"/>
       <f:selectItems value="#{exampleBean.cities}" />
    </h:selectOneMenu>How can I get the third one is updated?
    Message was edited by:
    aliok.tr

    Those menu's look fine.
    Likely there's just something wrong in the backing bean's logic where the lists are been populated.

  • Editable datatable field validation when using datascroller pagination

    Hi,
    Im using tomahawk-1.1.8 and myfaces-api-1.2.6 I have an editable datatable with each rows having the following set of fields
    selectBooleanCheckBox , three selectOneMenus , three outputTexts, three inputTexts
    There will be close to 200 rows in the table so im using t:dataScroller to paginate the datatable.
    The following are my requirements
    1     All elements of the form except the selectBooleanCheckbox must be disabled on load of the page.
    2     On clicking on the boolean check box the corresponding rows must be enabled.
    3     I should be able to extract only the selected row in the bean side to perform some action and finally save it in the database.
    4     On submit of the page I should validate the following.
    a. at least one check box is selected
    b. Whether all the three intputTexts in the row have values and must also verify if they have valid values.
    c. Rows which are not selected (using check box) need not be considered for validation
    d. if any invalid data is found appropriate error message must be thrown and that particular element should be given the focus
    On seeing the requirement I felt it’s better to use Javascript to enable/disable controls and to validate data. Everything works fine if I have all the controls in a single page. But since I have server side pagenation enabled (using datascroller) I’m able to access only the current page form elements from javascript. In shot I’m able to access only the elements which are in the page from where I click on submit.But the user may change data in several pages and finally submit.
         This leads me to a situation where validation can be done using JSF only. I’m ok to do validations in JSF using a custom validator .But certain things like enabling or disabling controls on the form and the onLoad behavior can be coded using javascript only. This is because if I set the values such as disabled=”true” on the jsf inputText tag itself it is taking effect every time I move out and come back to the same page.
    I’m new to JSF . Can someone assist me in this. It’s pretty URGENT….
    Thanks,
    Swami

    Hi,
    Thanks for your quick response. I tried setting the disabled attribued based on you suggestion . But the enabling/disabling will not be immediate. I will have to go to some other page and come back to the first page to see the change in state.
    For eg:
    a. I defaulted the 'selected' attribute of bean to 'false' .So all rows loaded in disabled state as expected.
    b. Now if i check the check box other dependant fields will not be enabled immediately . I will have to move do different page and come back to current page for seeing the controls in enabled status.
    To overcome this problem i wrote some javascript function to set the selected rows elements' disabled property to false. I wrote something like the following for every element in the data row . After this the fields got enabled immediately on selecting check box
    document.getElementById("<form name>:<data table name>:"+rowIndex+":<element name1>").disabled=false;
    document.getElementById("<form name>:<data table name>:"+rowIndex+":<element nameN>").disabled=false;
    But now there is one more problem
    1. The page loads with all elements disabled.
    2. I click on the select box and javascript enables the controls on the row (in page 1)
    3. I change a value in a text box in the enabled row and move to page 2.
    4. Come back to page 1 and see the new value of text box not being retained.
    5. I change the value in the same text box again and move to page 2 .
    6. Come back to page 1 and see the new value getting retained.
    After some initial analysis i found that the the change in value of a form element (text box in this example) which is in disabled status will not be updated in the backing bean on page submit i.e the setter methods will not be called for these elements .Though i enabled it using javascript its actuallly still disabled accoring to the bean attributes.
    So in step 3 of the above example the setter methods are not getting called since the field is disabled according to bean. On the contrary , in step 5 the setter methods are getting called when moving to page 2 since the state is enabled according to bean.
    Problem  2
    I have a column containg two elements out of which one can be present based on the value of another selectOneBox in the same row.In the below example based on value of 'type' ,either 'station' or 'period' should be displayed.
    I have set display style as none in station assuming that zone should be displayed on page load.
    style="display:none" This is causing problem when i navigate accross pages. When i go to a different page and come back then the zone is getting displayed irrespective of the value of type. This is because the page is rendered again with the default values.
    <t:column>
    <f:facet name="header">
    <t:outputText value="type" />
    </f:facet>
    <h:selectOneMenu
    id="type"
    value="#{row.typeIndex}"
    onchange="fnHideControls('#{rowIndex}'); return false;"  disabled="#{!(row.selected)}">
    <f:selectItems
    value="#{bean.lstType}" />
    </h:selectOneMenu>
    </t:column>     
    <t:column>
    <f:facet name="header">
    <t:outputText value="Station/Period" />
    </f:facet>
    <h:selectOneMenu
    id="Station"
    value="#{row.stationIndex}"
    style="display:none" disabled="#{!(row.selected)}">
    <f:selectItems
    value="#{bean.lstStation}"  />
    </h:selectOneMenu>
    <h:selectOneMenu
    id="period"
    value="#{row.periodIndex}"
    disabled="#{!(row.selected)}" >
    <f:selectItems
    value="#{bean.lstPeriod}" />
    </h:selectOneMenu>
    </t:column>Can you help me out with both these problems.
    Thanks,
    Swami.

Maybe you are looking for

  • UCCX 9.0(2) - CUIC Reports Call Abandoned calls inconsistencies

    Hi, We are finding that the there are inconsistencies in the abandons figures shown for a CSQ report for 'Contact Service Queue Activity Report' and the calls that are shown in the 'Abandoned Call Detail Activity Report'. For example if I view a CSQ

  • Can not release change list in Integration Builder: Design

    I got the following error any time i try to release a change list in the integration builder: Design. #18 13:51:21 AWT-EventQueue-0 ERROR com.sap.aii.utilxi.swing.toolkit.ExceptionDialog: Throwable Thrown: MESSAGE ID: com.sap.aii.ib.gui.operations.rb

  • How can I sort my videos by the time it was recorded?

    I recorded a wedding and I was using two cameras. One camera was used at one certain time while the other was used during another. When I import all my videos into premiere pro, I would like the videos to be shown in the chronological order it was re

  • 8900 to imac bluetooth connection for file transfer

    Hello,  I  have a brand new curve 8900 javelin and a new IMAC.  Both devices can see each other and I can manage to get a green connection light however it only lasts a few seconds and then disconnects.  Can someone please tell me how to overcome thi

  • Firefox freezes when I switch tabs or write in a form.

    Every time I switch tab by clicking on them(and sometimes when using the short cut, ctrl+tab ctrl+2 etc) or when I start writing in the awesomebar/a form Firefox freezes. It just visual freeze so I can still go to a website, click on stuff and so on.