This discussion is archived
12 Replies Latest reply: Jan 9, 2013 6:22 AM by adf009 RSS

disable inputtext based on lov selection

adf009 Explorer
Currently Being Moderated
hi i have situation where i what to disable inputtext based on the been selected in LOV,FOR example if i select GOV code in my lov i what my inputtext to be disable,am in jdeveloper 11.1.1.6.0
my lov is
<af:selectOneChoice
                                        label="#{bindings.LutOrganisationtypesView1.label}"
                                        required="#{bindings.LutOrganisationtypesView1.hints.mandatory}"
                                        shortDesc="#{bindings.LutOrganisationtypesView1.hints.tooltip}"
                                        id="soc2"
                                        autoSubmit="true"
                                        simple="true" immediate="true"
                                        value="#{pageFlowScope.orgDetailsBean.category}">
                                        
                                      <af:forEach items="#{bindings.LutOrganisationtypesView1.iteratorBinding.allRowsInRange}"
                                  var="row">
                        <af:selectItem id="tiltcosBB2" label="#{row.description}"
                                       value="#{row.organisationtypecode}"/>
                      </af:forEach>      
                                    </af:selectOneChoice>

and my inputtext is
<af:inputText
                                  label="#{bindings.regNumber.hints.label}"
                                  columns="#{bindings.regNumber.hints.displayWidth}"
                                  maximumLength="#{bindings.regNumber.hints.precision}"
                                  shortDesc="#{bindings.regNumber.hints.tooltip}"
                                  id="it2" simple="true"
                                  value="#{pageFlowScope.orgDetailsBean.regNumber}"
                                  partialTriggers="soc2" immediate="true"
                                  required="#{pageFlowScope.orgDetailsBean.category == 2?'false':'true'} "
                                  disabled="#{pageFlowScope.orgDetailsBean.category == 2?'false':'true'} ">
                      <f:validator binding="#{bindings.regNumber.validator}"/>
                      <af:convertNumber groupingUsed="false"
                                        pattern="#{bindings.regNumber.format}"/>
                    </af:inputText>
  • 1. Re: disable inputtext based on lov selection
    Timo Hahn Oracle ACE
    Currently Being Moderated
    So what is the problem? I don't see any. As long as your LOV returns (or writes ) 2 into the variable #{pageFlowScope.orgDetailsBean.category} when you select 'GOV' it should work.

    So have you check that (e.g. by putting an ouputText component on the page with value="#{pageFlowScope.orgDetailsBean.category}")?

    Timo
  • 2. Re: disable inputtext based on lov selection
    adf009 Explorer
    Currently Being Moderated
    the problem is its not working the way it is now
  • 3. Re: disable inputtext based on lov selection
    Mohammad Jabr Guru
    Currently Being Moderated
    can you try this
    required="#{pageFlowScope.orgDetailsBean.category == 2 ? false : true } "
    instead of this
    required="#{pageFlowScope.orgDetailsBean.category == 2?'false':'true'} "
  • 4. Re: disable inputtext based on lov selection
    adf009 Explorer
    Currently Being Moderated
    is still not working this is my inputtext, i did everything i know and still not working can anybody help
    <af:inputText
                                      label="#{bindings.regNumber.hints.label}"
                                      columns="#{bindings.regNumber.hints.displayWidth}"
                                      maximumLength="#{bindings.regNumber.hints.precision}"
                                      shortDesc="#{bindings.regNumber.hints.tooltip}"
                                      id="it2" simple="true"
                                      value="#{pageFlowScope.orgDetailsBean.regNumber}"
                                      partialTriggers="soc2"
                                      required="#{pageFlowScope.orgDetailsBean.category == 2 ? false : true } "
                                      disabled="#{pageFlowScope.orgDetailsBean.category == 2 ? false : true } ">
                          <f:validator binding="#{bindings.regNumber.validator}"/>
                          <af:convertNumber groupingUsed="false"
                                            pattern="#{bindings.regNumber.format}"/>
                        </af:inputText>
    
    when i try this the inputtext load disable and does not change when i make new selection in LOV,it stick disable all the time
    
    
    <af:inputText
                                      label="#{bindings.regNumber.hints.label}"
                                      columns="#{bindings.regNumber.hints.displayWidth}"
                                      maximumLength="#{bindings.regNumber.hints.precision}"
                                      shortDesc="#{bindings.regNumber.hints.tooltip}"
                                      id="it2" simple="true"
                                      value="#{pageFlowScope.orgDetailsBean.regNumber}"
                                      partialTriggers="soc2"
                                      required="#{row.organisationtypecode == 1 ? false : true}"
                                      disabled="#{row.organisationtypecode == 1 ? false : true}"
                                      autoSubmit="false" immediate="true">
                          <f:validator binding="#{bindings.regNumber.validator}"/>
                          <af:convertNumber groupingUsed="false"
                                            pattern="#{bindings.regNumber.format}"/>
                        </af:inputText>
    my lov is
    <af:selectOneChoice
                                            label="#{bindings.LutOrganisationtypesView1.label}"
                                            required="#{bindings.LutOrganisationtypesView1.hints.mandatory}"
                                            shortDesc="#{bindings.LutOrganisationtypesView1.hints.tooltip}"
                                            id="soc2"
                                            autoSubmit="true"
                                            simple="true"
                                            value="#{pageFlowScope.orgDetailsBean.category}">
                                            
                                          <af:forEach items="#{bindings.LutOrganisationtypesView1.iteratorBinding.allRowsInRange}"
                                      var="row">
                            <af:selectItem id="tiltcosBB2" label="#{row.description}"
                                           value="#{row.organisationtypecode}"/>
                          </af:forEach>      
                                        </af:selectOneChoice>
    i also try this with no luck
    <af:inputText
                                      label="#{bindings.regNumber.hints.label}"
                                      columns="#{bindings.regNumber.hints.displayWidth}"
                                      maximumLength="#{bindings.regNumber.hints.precision}"
                                      shortDesc="#{bindings.regNumber.hints.tooltip}"
                                      id="it2" simple="true"
                                      value="#{pageFlowScope.orgDetailsBean.regNumber}"
                                      partialTriggers="soc2"
                                      required="sel: #{pageFlowScope.orgDetailsBean.category == 'PRIV'}"
                                    disabled="sel: #{pageFlowScope.orgDetailsBean.category == 'GOVT'}"
                                      valueChangeListener="#{pageFlowScope.orgDetailsBean.valueChanged}"
                                      autoSubmit="true">
                          <f:validator binding="#{bindings.regNumber.validator}"/>
                          <af:convertNumber groupingUsed="false"
                                            pattern="#{bindings.regNumber.format}"/>
                        </af:inputText>
    its not disabling the inputtext based on lov selection

    i have re-create a problem where can i upload it

    Edited by: adf0994 on 2012/12/13 5:10 PM
  • 5. Re: disable inputtext based on lov selection
    Timo Hahn Oracle ACE
    Currently Being Moderated
    adf0994,
    the disabled property should evaluate the either true (EL!=0) or false (EL== 0). Yous
     disabled="sel: #{pageFlowScope.orgDetailsBean.category == 'GOVT'}"
    will always be 'sel: ...' which is != 0 so it'll be true.

    Timo

    By the way this look like a duplicate of {thread:id=2475862}
  • 6. Re: disable inputtext based on lov selection
    adf009 Explorer
    Currently Being Moderated
    I have upload the link whith the file hope somebody will help me,please guys lets share the knowledge
    http://www.filedropper.com/lovcascanding

    Edited by: adf0994 on 2012/12/14 10:46 PM

    Edited by: adf0994 on 2012/12/15 7:32 PM
  • 7. Re: disable inputtext based on lov selection
    Timo Hahn Oracle ACE
    Currently Being Moderated
    adf0994,
    I took a look at your sample. The sample has some issues (like the sql you delivered with it does not run). The reason the sample does not work is that you mix model driven cascading lov with bean implementation. When you store the selected value of the first model driven lov in a bean, the cascading doe not work any longer as the needed parameter for the view accessor is not there.
    So my first advise would be to leave the default model driven lov as is, as your use case works OK using this approach. All you need to do is to make sure that the first LOV is set to autoSubmit='true' and the second one adds a partial trigger pointing to the first lov. Then you set the disaple propoerty of the inputText to
    #{bindings.Organisationtypecode.inputValue eq '1'}
    As you see it's necessary to use the index of the 'GOVT' selection (which is 1) as only this is available (without writing some bean code).
    Here is the code of my new fragment which works OK.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich" xmlns:f="http://java.sun.com/jsf/core">
      <af:panelStretchLayout id="psl1">
        <f:facet name="center">
          <af:panelFormLayout id="pfl1">
            <af:selectOneChoice value="#{bindings.Organisationtypecode.inputValue}" label="#{bindings.Organisationtypecode.label}"
                                required="#{bindings.Organisationtypecode.hints.mandatory}" shortDesc="#{bindings.Organisationtypecode.hints.tooltip}" id="soc2"
                                autoSubmit="true">
              <f:selectItems value="#{bindings.Organisationtypecode.items}" id="si1"/>
            </af:selectOneChoice>
            <af:selectOneChoice value="#{bindings.Orgsubtypecode.inputValue}" label="#{bindings.Orgsubtypecode.label}"
                                required="#{bindings.Orgsubtypecode.hints.mandatory}" shortDesc="#{bindings.Orgsubtypecode.hints.tooltip}" id="soc1"
                                partialTriggers="soc2" autoSubmit="true">
              <f:selectItems value="#{bindings.Orgsubtypecode.items}" id="si2"/>
            </af:selectOneChoice>
            <af:inputText value="#{bindings.Registrationnumber.inputValue}" label="#{bindings.Registrationnumber.hints.label}"
                          required="#{bindings.Registrationnumber.hints.mandatory}" columns="#{bindings.Registrationnumber.hints.displayWidth}"
                          maximumLength="#{bindings.Registrationnumber.hints.precision}" shortDesc="#{bindings.Registrationnumber.hints.tooltip}" id="it1" partialTriggers="soc2"
                          disabled="#{bindings.Organisationtypecode.inputValue eq '1'}">
              <f:validator binding="#{bindings.Registrationnumber.validator}"/>
            </af:inputText>
            <af:outputText value="outputText1 -- #{bindings.Organisationtypecode.inputValue}" id="ot1" partialTriggers="soc2"/>
          </af:panelFormLayout>
          <!-- id="af_one_column_stretched"   -->
        </f:facet>
      </af:panelStretchLayout>
    </jsp:root>
    Timo
  • 8. Re: disable inputtext based on lov selection
    adf009 Explorer
    Currently Being Moderated
    hi timo thank you vey much,but is it possible to do the same using bean which i was trying to do in this post
    cascading lov using bean not passing selected LOV value
  • 9. Re: disable inputtext based on lov selection
    Timo Hahn Oracle ACE
    Currently Being Moderated
    The question is: Why?
    You try to use model driven list of values without the model part then. It's not impossible, but harder to do with more coding needed. As you don't know your way around adf that good I'll advice to stay with the default implementation as long as there is no real reason not to. This reason I don't see right know.

    From the setup of your sample it's the other way around as you use a VO bounded to the page to show the dependent LOV in the first place. So why store the values in a bean?

    Timo
  • 10. Re: disable inputtext based on lov selection
    adf009 Explorer
    Currently Being Moderated
    ok the reason why am storing values using a bean,is that the project/application was started using bean,remember this is part of application so i don't what to mix the two view and bean,if i don't use the bean i will not be able to insert/create other values in database,i personally like to do it this way but the person who start this application did not undestand adf,the person mix java and adf and thought is the same thing,i just what to complete this part of application in bean,and keep development in adf standard not java,i will appriciate if you can help. i have already write some java code to do cascanding lov in bean am just missing some logic. i have upload the sample http://www.4shared.com/zip/tmSc3HvU/BeanLovCascanding_2.html

    Edited by: adf0994 on 2012/12/17 1:40 PM

    Edited by: adf0994 on 2012/12/20 1:01 PM
  • 11. Re: disable inputtext based on lov selection
    Timo Hahn Oracle ACE
    Currently Being Moderated
    adf0994,
    this is the time to think about redesigning the application.
    You can't expect us do find workarounds for your self-made problems, when it would all be easy if you would have used the framework the right way (which is definitely documented).

    Timo
  • 12. Re: disable inputtext based on lov selection
    adf009 Explorer
    Currently Being Moderated
    hi am using iterator to get values from the views using the cascading lov,but now am geting PRIV VALUES only
        public String getorgtype(){
            DCIteratorBinding it = ADFUtils.findIterator("UamOrganisationsView1Iterator");
            
             
             
            String orgtype = null;
           
            if(it != null && it.size() >0){      
             for(Row r : it.getAllRowsInRange() ) {
                 
                 
             orgtype = (String)r.getAttribute("Organisationtypecode");
           
                 System.out.println("orgtype " + orgtype);
                   
                }        
           
            }
            return orgtype;
                             
        }
        public String getsubtype(){
            DCIteratorBinding it = ADFUtils.findIterator("UamOrganisationsView1Iterator");
             
             
            String subtype = null;
            
            if(it != null && it.size() >0){      
             for(Row r : it.getAllRowsInRange() ) {
                
                 
             subtype = (String)r.getAttribute("Orgsubtypecode");
            
                 System.out.println("subtype " + subtype);
                  
                }        
          
            }
            return subtype;
                             
        }
     my printout is
    orgtype GOVT 
    orgtype PRIV 
    orgtype PRIV 
    orgtype GOVT 
    orgtype PRIV 
    orgtype GOVT 
    orgtype PRIV 
    orgtype GOVT 
    orgtype PRIV 
    orgtype GOVT 
    orgtype PRIV 
    orgtype PRIV 
    orgtype GOVT 
    orgtype GOVT 
    orgtype GOVT 
    orgtype PRIV 
    orgtype GOVT 
    orgtype PRIV 
    orgtype GOVT 
    orgtype GOVT 
    orgtype GOVT 
    orgtype GOVT 
    orgtype PRIV 
    orgtype GOVT 
    orgtype PRIV 
    printorgtype PRIV 
    subtype DCSP
    subtype DEA
    subtype DOD
    subtype DCOM
    subtype DCOM
    subtype DGCIS
    subtype CC
    subtype DCOM
    subtype PTN
    subtype DED
    subtype DEA
    subtype PTN
    subtype PTN
    subtype DOD
    subtype DED
    subtype PVT
    subtype DCOM
    subtype DEA
    subtype DCG
    subtype DEA
    subtype DBE
    subtype DPE
    subtype DHA
    subtype DBE
    subtype PVT
    printsubtype PVT
    Edited by: adf0994 on 2013/01/09 5:15 PM

    Edited by: adf0994 on 2013/01/09 5:22 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points