Jdev v.10.1.3.4 - hide inputtext af based on the drop-down list box

Hello

I'm trying to hide and display a text entry box based on what is selected by a drop-down list box. I have some difficulty getting the javascript code I think that to read the value of the selection box.

Here is a simple example of what I'm trying to do. I tried a couple of different ways but no luck. I appreciate any help anyone can offer.

Thank you
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
<f:view>
  <afh:html>
    <afh:head title="test">
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>

    </afh:head>
    <afh:body>
<f:verbatim>
        <script type="text/javascript">
        function changed(){
           if(document.getElementById("current").value =="1" ){
            document.getElementById("currentSize").style.display='block'; //show textbox
            }
            else{ 
            document.getElementById("currentSize").style.display='none'; //hide textbox
            }
        }
        
        </script>
</f:verbatim>
    
    
    
    <h:form>
        <af:selectOneChoice id="current" label="select item" onchange="change();">
          <af:selectItem label="item 1" value="1"/>
          <af:selectItem label="item 2" value="2"/>
          <af:selectItem label="item 3" value="3"/>
          <af:selectItem label="item 4" value="4"/>
        </af:selectOneChoice>
      <af:inputText label="Input Size:" maximumLength="5" id="currentSize" columns="7" rows="1"/>              
      </h:form></afh:body>
  </afh:html>
</f:view>

It works if you use af:form instead of h:form?
What happens if you set the partial relaxation of the af: form to point to the 'current '?

Tags: Java

Similar Questions

  • Hide/Show Pages based on the drop-down list selection

    Hello

    It drives me crazy. I have 3 boxes in this form (attached) and based on what is checked, I want to hide the first page and navigate to the 1st box checked. It works for the Web Chat feature, but others do not. In addition, the button following Web Chat page, when I click Next, I have a pop alert that should show only if Web Chat is the only selection, but it shows little matter how many selections are made from the boxes.

    As always, any help is appreciated!

    Hi, check if it works properly now.

    Dallas

  • Show/hide fields based on the drop-down list

    Hello

    I'm trying to show/hide subforms with a drop-down list selection. I found a lot of information on the subject and ended up with what my script:

     form1.Page1.Division::exit - (JavaScript, client)
    
    switch (Page1.Division.rawValue)
    {
       case "1":
       SubformZZI.presence = "visible";
       SubformZZR.presence = "hidden";   
          break;
     
       case "2":
       SubformZZI.presence = "hidden";
       SubformZZR.presence = "visible";       
          break;
    }
    
    

    However, it does nothing when a selection is made in the drop-down list. I have the "SubformZZI" initially defined as 'Visible' and the 'SubformZZR', originally defined as "hidden".

    Any suggestions?

    Kind regards

    ZeroZone

    Check if the form is saved in dynamic form. File-> save as and choose dynamic for the type of shape...

    Other that that, you should check if you have given the values for the selection of the drop-down list as '1' and '2' in the tab of the control's binding.

    Thank you

    Srini

  • show/hide fields based on the drop-down list of choices

    I have a field from the drop-down list with three choices. Based on the selection, I need a specific text form field to appear and the others to stay hidden. (Or if it makes the code cleaner, the resulting field could be a drop-down list, too, with the selected choice.) I don't know Java well enough to extrapolate the code from the examples online and it fit my forms. I can provide an example of form. Thanks in advance for your help.

    There are ways to run this.  the easiest for you would be to add this script to the event (calculation of the Properties tab) to calculate the field that must be hidden.  Take notes, all "/ /" is some tips for you to understand the code.  You will need to put this script in all the areas you want to replicate the behavior, change the value depending on what you want to accomplish.  the word 'event' means myself to make you understand.

    If (this.getField("dropdown").value == 'put value here') {//replace "drop down" with the name of the drops}

    Event.Target.Display = display.visible;

    }

    else {}

    Event.Target.Display = display.hidden;

    }

    This works if you have a small amount of fields.  If you manage to have a large number of similar fields, let me know because there are other, faster ways.

  • Make a field of text/hide according to the results of a drop-down list box

    Hello

    I wonder if someone could help me with this. I want to show/hide some text boxes in my form according to the choice made by the person filling in. For example, there is a dropdown list containing a selection of numbers 1-4. If 1 was selected, the text boxes below 1 would be visible and obligatory, if the 2 have been chosen, 2 text boxes below would be visible and required etc...

    I'm new to FormCalc (only started using it this morning), so simple a possible explanation would be fantastic.

    Thanks for reading!

    Of course, you can have javascript and formcalc in the form. Not only the two in the same field, same event; D

    Okey, let's try some things:

    (1) check if the "binding" from the drop-down list is the same as the values that you choose. In the script you are referring to the bound values.

    (2) other names for the Textfields would be better, because it is more difficult to refer to "Textfield1 [1]" then to for example: 'New '. I was just to lazy to give them names. (If it's on another page or subform, you refer to the fields correctly: as MyForm.FirstSubform.FirstTextfield... this name lies in the specific script field.)

    (3) check your script once more... want to make invisible mandatory fields?

    (4) check if your form is dynamic. (If it isn't you will not see the changes...)

    You should probably do it in small steps, such as:

    (1) first of all, you refer to areas such as:

    This.rawValue = Firstfield.rawValue;

    If the changed value fields got you its name and to be sure that the event you put is the right one.

    (2) try the different parts of the script and look at how it works. Problems can be more easily found and then

  • Hide text in the field when the drop-down list is selected

    Hello, I am looking for a way to hide text in a text field when a number is from a drop-down list. For example, I have a table with text field that have a line pre-populated text in them. I would like the text to be deleted if 'Yes' is selected in a data entry drop-down list in the text box empty now.   Here's what I have so far:

    If (this.rawValue == 'Yes') {SubStandard_A.StandardPkgTbl.Row1.TextField2.rawValue == ' ' ;}}

    I tried .rawValue == "", .rawValue == null, .clearItems

    Any help is greatly appreciated!

    Hello

    Just spotted your original script had a double == when assigning the value to the rawValue. You must use the double == equality test.

    Here is a sample.

    We hope that make you it work.

    Niall

  • Hide several pages unless the drop-down list is selected

    Hello

    I have a 4-page form that I need to be able to hide 3 of 4 pages until a selection is made from a drop-down list on the first page box. So I have, for example, the pages marked:

    Page 1

    Page 2

    Page 3

    Page 4

    I have a drop down list which has

    Page 2

    Page 3

    Page 4

    for options and if no selection is made only Page 1, will be visible. If the selection is Page 2, I wish that all pages except page 2 to be hidden and only see page 2, did not 4 pages show and only show Page 2 fields.

    Does anyone know how to do this?

    Thanks in advance for any idea!

    The only downside to the activation of your condition is that the first page of the form can not be deleted. If you set page 1 "Hidden" will be hidden objects on the page, but the page itself will remain in the form that is displayed as a blank page.

    Attached shows a form with page 0-4 (5 pages). A drop down menu on page 0 and it controls the rendering of pages 1-4.

    Steve

  • [ADF, JDev 12.1.3] How to hide menu items based on the logged in user

    Hallo,

    When the user logs on successfully, the applitacions led him to the main.jspx page.

    The main.jspx page has a menu bar that contains all of the available menus, submenus and menu items.

    After the connection, when the main.jspx page loads I would hide all the menus, submenus and menu items that the user is not qualified to see/use (I read the database).

    You kindly tell me which is the way the cleaner to achieve?

    Thank you

    Federico

    user10709360 wrote:

    Hello rohanwalia,

    Sorry, but I need more help

    I guess that the solution is to create a method in the AM who - reading form the database - returns a structure that indicates for each menu item should be visible or hidden.

    • How can I use the data returned by this method?
    • I call in a managed bean specifically dedicated to the management of the menu? Can I also use the already existing media bean, I created for the page?
    • What scope should have the bean?
    • Don't you think that it is better to define a 'visible' variable Boolean (initilized depending on the result of the AM method) for each menu item and how to bind the Visible property of each menu item to the variable respective in the bean in the bean?
    • Or I can loop the result of the method AM setting the Visible property of the menu items? In this case, I guess that all the menu items must be mapped into the bean by user interface variable. Am I wrong?
    • Is it not possible to write a method which, of the AM directly, hide the menus not necessary on the page (so without using a bean)?
    • In general, which are the correct always to hide menu items:
      • (1) before the page is sent to the browser (as "I can do it with PHP);
      • (2) once the page is loaded in the browser (as I can do it with JavaScript)?

    If you could give me some more detailed advice... I would be very happy.

    Thank you

    Federico

    (1) its best to make the treatment inside the method. You can return the parameters as normal java method.

    (2) Yes, you can use bean already exists in the project. But better to create a separate bean for this task of menu.

    (3) scope should be request unless you need to persist the attributes between requests.

    (4) Yes it is possible. You can define and initialize a Boolean variable with the results you get from the table based on the menu items should be made visible.

    (5) If you use the approach to point 4, then also you have to loop through the table menu items and set Boolean variables of bean. Yes you are right for the second part.

    (6) I'm not sure about this approach. How will you map it to your menu mode. It takes research.

    (7) before the page is loaded. I share with you links in above post with which you can do this.

    I hope this helps.

    Thank you

  • Show/hide region when the drop-down list is changed

    Hello

    I need show/hide a region when dropdow (selection list) is changed.

    I used dynamic action:

    Event : change
    Selection Type : Item(s)
    Item(s):P50_my_list
    condition : JS expression
    $v('P50_my_list') == 1
    
    True Action :
    Action : Execute JS Code
    Code : $('#region_name').show();
    
    // OR use Action ==> Show
    
    

    False Action :
    Action : Execute JS Code
    Code : $('#region_name').hide();
    
    // OR use Action ==> hide
    

    But the region has still shown!

    Also, I used a JS function (in the dynamic action of the place) but I met the same result.


    function showHideRegion(pValue)
    {     var show_or_hide = $x(pValue).value;
        if (show_or_hide == 1)
          {$('#ALTERNATIVEN_LIST').hide();}
        else
          {$('#ALTERNATIVEN_LIST').show();}
    }
    
    
    

    Hello

    I solved the problem with the js function:

    function showHideRegion (pThis, pValue)

    {var show_or_hide = $x (pValue) .value;}

    If (show_or_hide == 1)

    {

    var element = $x_UpTill (pThis, 'DIV');

    Element.style.display = 'none ';

    } else {}

    var element = $x_UpTill (pThis, 'DIV');

    Element.style.Display = "block" ;}

    }

  • How to hide the drop-down list of the Chat pane

    Hello

    I had provided that I don't want the combobox associated the SimpleChat component and the text "user typing" is anyway to hide those. ?

    Hello

    My advice for your case would be to build your own simpleChat UI with the simpleChatModel that we provide and you can have the freedom to do whatever the desired user interface. Our example of SimpleChat folder samepleApps built a UI using the SimpleChatModel cat.

    However, if you feel to follow the path of quick fix, you can simply override the createChildren() or other functions in your subclass of CustomSimpleChat of SimpleChat and use only visible/hide no matter which component. You can look at the source code for player 9 in SimpleChat for more details. Its useful as a reference in many cases the same if you use Player 10 swc.

    For your specific case, you can do this in your subclass

    Override protected function createChildren() (): void

    {

    super.createChildren ();

    {if (_toCombo)}

    _toCombo.visible = false; to make the invisible combobox

    }

    }

    Override protected function commitProperties (): void

    {

    super.commitProperties ();

    If {(_typingLabel)

    _typingLabel.visible = false; to make typing invisible label

    }

    }

    Thank you

    Concerning

    Hironmay Basu

  • Hide the drop-down list when you print only when "PLEASE SELECT" is selected (unused field).

    Our form has several drop-down lists that by default the option "Choose", and not all of them are used whenever the form is used.  When we print a copy of each document, we would like the (unused) field "Choose" to disappear when printing - to make a copy of paper filter.  Is there a script for this?  I tried to use only the general framework ' Visible but does not print ", but of course, the field prints any - we need to print only when there was one another option as the default"Select"is selected.  Thanks in advance for your help.

    Coleen

    You can use a custom validation script, something like:

    Event.Target.Display = event.value = "choose"? display.noPrint: display.visible;

    To put this into effect, you will need to make a different choice and place it back to "choose." Another option would be to place as a custom Format script.

  • Show drop-down list field hide selection in another drop-down list box

    Hello I need to create two drop-down fields on a dynamic PDF in LiveCycle. The first field contains three choices. When a user selects an item in the drop-down list first I would like to a new field of drop-down list has been shown. For each item in the first drop-down list appears a new field drop-down list with unique values. If the user chooses blue drop-down list of blue shades indicate in this menu drop-down will be various shades of blue to choose for. If the Red is chosen, Shades of Red dropdown with appearance and if yellow is displayed the same occurs. Also if the user must go back and change their selection in the first drop-down list, they can do the same. Any suggestions?

    Thank you in advance.

    There are 2 ways you could do this. The first is just to have the 3 drop-down lists for the second box to separate and do them all hidden. The output of the first dropdown event would then have the code that would make it the second box become visible, something like (in formcalc):

    If ($ == 1) then

    dropdownRed.presence = "visible".

    dropdownBlue.presence = "hidden".

    dropdownYellow.presence = "hidden".

    ElseIf ($ == 2) then

    dropdownRed.presence = "hidden".

    dropdownBlue.presence = "visible".

    dropdownYellow.presence = "hidden".

    ElseIf ($ == 3) then

    dropdownRed.presence = "hidden".

    dropdownBlue.presence = "hidden".

    dropdownYellow.presence = "visible".

    endif

    The other option is just to have a dropdown that dynamically changes its options based on the results of the first box. So in the second box preOpen event you might have something like (in formcalc):

    If (dropdown1 == 1) then

    $. clearItems()

    $.setItems ("light red, dark red")

    ElseIf (dropdown1 == 2) then

    $. clearItems()

    $.setItems ("sky blue, dark blue")

    ElseIf (dropdown1 == 3) then

    $. clearItems()

    $.setItems ("light yellow, dark yellow")

    endif

  • Show/hide video Clips with a drop-down list box. Help!

    Hi all

    I was hoping someone here could point me in the right direction with this.

    I have a combo box that loads data from an xml file I want to use to toggle the visibility of various clips on the stage.

    I should do in ActionScript (can I?) or should it be done in the components Inspector, or can it still be done this way.

    Thanks - snake

    The code below, there are three movieclips involved, with names of "mc1", "mc2" and "mc3" instance assigned to them as data value of each item of the combobox. The combobox control has an instance name of "cbox". In this case, given that the combobox control is the first item selected by default, the first movieclip, mc1, appears. If you study the code, you will come if all goes well to understand it enough for this model to your specific needs.

  • Hide the fields to add fields drop-down list in the advanced search mode.

    On the drop-down list to add fields in the field of the advanced search displayed by an af:query, is there a way to hide some of the attributes? He seems to show all the attributes of the default VO.

    The fields must be visible on other pages that use the VO. Table Panel and search queries will only to display a subset of the fields in the VO.

    Assigning to the attribute Display tip to hide will not do; at least this seems to be the case, because if I do that, then, the field is not available on the data control to be placed on other pages.

    I guess I could create a separate VO just to the search page; but I try to avoid this, it invites excessive maintenance as the system grows. If no indication on how to hide a field VO on add fields while leaving the field to be displayed on other pages would be appreciated.

    Versions: JDeveloper 11.1.1.4, ADF business 11.1.1.59.23 components.

    Thank you.

    I wrote a blog post on this subject and a sample of http://tompeez.wordpress.com/2012/01/06/jdev-afquery-hide-some-attributes-from-query-panel-but-show-them-in-the-result-table/ here

    Timo

  • Hide drop-down list in the Section of Pages in Pivot mode

    Hello

    I have a condition of report where I need to use columns in the section of Pages in Pivot mode, but I need to hide the display so that it cannot be displayed to the user.
    Is there a way we can achieve this. I am able to hide the values inside the hidden option or by giving the white police and in color, but the drop still exists. I want to hide even the drop-down list also, the user does not know that there is no drop-down list. I can't remove the pivot as my report depends on these columns showing rolling months of data. There are a lot of customization in this report, can you get it someone please let me know no work around for this problem.

    Thank you
    Knockaert

    Hi Karthik,

    You can hide the fall down by adding the css code.

    In responses, add a static text / narrative view and Add (enable html) code below

    otherwise in the dashboard add text and enter the code above it...
    This will hide the drop down.

    Thank you
    Vino

Maybe you are looking for