2 Replies Latest reply on Sep 10, 2008 7:33 AM by gopi b

    select one menu item It display some comment and one inputtextbox

    gopi b Newbie
      Hi
      I am new to richfaces, I created one drop down box using selectOneMenu, creating upto drop down box is ok but the problem is , If i select any item from the drop down box at the same time i should display  display one comment and one input text box, for others. please find the code below, thank u.


      xhtml:
      -------
      <h:outputText  styleClass="formFont" value="Academic Qualification"></h:outputText>
                 </h:column>
                 <h:column>
                <a4j:region>
               
                 <h:selectOneMenu styleClass="formColumnInputText" required="true" value="title" >
                 <f:selectItem  itemValue=" " itemLabel=" "/>
                 <f:selectItem  itemValue="Secondary Level" itemLabel="Secondary Level"/>
                 <f:selectItem itemValue="Degree Level" itemLabel="Degree Level"/>
                 <f:selectItem itemValue="Post Graduate" itemLabel="Post Graduate"/>
                 <f:selectItem itemValue="Others" itemLabel="Others" />
                 <a4j:support event="onchange" action="#{uiRenderer.updateView()}" reRender="ot1" ajaxSingle="true" />
                 </h:selectOneMenu>
                
                </a4j:region>
                 </h:column>  
                 <h:column>
                 <a4j:outputPanel id="ot1" rendered="#{uiRenderer.visible}" >
                 <h:outputText value="If Others(Please specify here)"/>
                 <h:inputText  value=" " ></h:inputText>
                 </a4j:outputPanel>



      seam class file:
      ----------------

      package com.manam.mortgage.session;

      import org.jboss.seam.annotations.Name;

      @Name("uiRenderer")
      public class UIRenderUtil {

           
           private String listValue;
           private boolean visible;
           
           
           public void updateView(){
                System.out.println("Visible Value" +visible);
                System.out.println("Method Called. 34...... ");
                this.setVisible(true);
           }
           public boolean isVisible() {
                return visible;
           }

           public void setVisible(boolean visible) {
                System.out.println("Method Visible Called");
                this.visible = visible;
                System.out.println("Visible Value" +visible);
           }

           public String getListValue() {
                return listValue;
           }

           public void setListValue(String listValue) {
                this.listValue = listValue;
           }
           
      }
        • 1. Re: select one menu item It display some comment and one inputtextbox
          Damian Harvey Apprentice

          Your selectOneMenu is not bound to anything on the back-end.


          Try something like : <h:selectOneMenu styleClass="formColumnInputText" required="true" value="#{uiRenderer.title}" > and add the relevant title field to your UiRenderer class (with getter + setter).


          You'll also probably want to check the value of title before you set visibile to true or false.


          Cheers,


          Damian.

          • 2. Re: select one menu item It display some comment and one inputtextbox
            gopi b Newbie
            I am trying to this code also

            <h:selectOneMenu styleClass="formColumnInputText" required="true" value="#{uiRenderer.title}" >

            and writing to setters and getter in title

            public String getTitle() {
                            return title;
                    }
                    public void setTitle(String title) {
                            this.title = title;
                            this.setVisible(true);
            }
            But same problem can't display what happen please any body tell me, thank's