Select many Listbox - limit the number of items can be selected

Hello

I use Jdev 11.1.1.4.0.

I have a component to select many Listbox in a jspx page. Requirement is that the user can select up to 5 items of the listbox. I have to somehow keep track of the number of selection and ask the user if there is more than selected 5. My plan is to:

1 bind the component in a backingbean
2. listen ValueChangeListener and obtain the total number of selected items
3. If selected is greater than 5, prompt the user.

Any suggestion, comment or pointer will be greatly appreciated.

Thank you

Bones Jones

See this example for SelectManyListBox when it prompts a message - when the number of records selected is greater than 2.

Sample.JSPX:



xmlns:f = "http://java.sun.com/jsf/core".
xmlns:h = "http://java.sun.com/jsf/html".
xmlns:af = "http://xmlns.oracle.com/adf/faces/rich" >




*
selectAllVisible = "false".
* Binding = "#{SampleBean.selectManyListBox}" *.
* inlineStyle = "width: 400px."
* autoSubmit = "true."
* valueChangeListener = "#{SampleBean.valueChangeListener}" > *.
**
**
**
**
**
**



* SampleBean.Java: *.

import java.util.List;

Import javax.faces.application.FacesMessage;
Import javax.faces.context.FacesContext;
Import javax.faces.event.ValueChangeEvent;

Import oracle.adf.view.rich.component.rich.input.RichSelectManyListbox;
Import oracle.adf.view.rich.context.AdfFacesContext;

public class SampleBean {}
private RichSelectManyListbox selectManyListBox;

public SampleBean() {}
}

{} public void setSelectManyListBox (RichSelectManyListbox selectManyListBox)
this.selectManyListBox = selectManyListBox;
}

public RichSelectManyListbox getSelectManyListBox() {}
return selectManyListBox;
}

* public Sub valueChangeListener (ValueChangeEvent valueChangeEvent) {*}
* if (selectManyListBox! = null) {*}
List = (List) valueChangeEvent.getNewValue () selectedValues; *
* if (selectedValues! = null & selectedValues.size () > 2) {*}
* this.selectManyListBox.setValue (valueChangeEvent.getOldValue ()); *
* AdfFacesContext adfFacesContext = *.
* AdfFacesContext.getCurrentInstance (); *
* adfFacesContext.addPartialTarget (this.selectManyListBox); *

* FacesContext context = FacesContext.getCurrentInstance (); *
* FacesMessage msg = *.
* new FacesMessage (FacesMessage.SEVERITY_ERROR, null, *)
(* ' The number of values selected in the selection list box number cannot be more than 2 "); *
* Context.AddMessage (null, msg); *

*}*
*}*
}
}

Thank you
Nini

Tags: Java

Similar Questions

  • How to limit the number of printers can be installed on this computer by using Group Policy?

    How to limit the number of printers can be installed on this computer by using Group Policy?

    Hello

    Thanks for asking! If I understand correctly, you should limit the printers installed on the computer by using Group Policy. I suggest you follow the troubleshooting steps to check if this may help.

    The question you have posted is related to Technet and would be better suited to the Technet community. Please visit the link below to find a community that will provide the best support.
    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer

  • How to limit the number of items listed when hover over Menu of Control Panel

    original title: Panel Menu controls

    Hey there,

    I want to limit the amount of results when I hover over the control panel in the start menu, when I displayed it as a menu...

    Currently, I have about 25-30 items displayed there and it takes about 2 to 4 seconds to load the menu, I would just have to charge about 10 Articles and give me the ability to scroll the rest of them. Any help would be appreciated!

    Hi Berthier, Chad

    Thanks for choosing Microsoft Community!

    Unfortunately, there no option to perform this task.

    You can submit your comments using the link:

    http://support.Microsoft.com/common/survey.aspx?scid=sw;en-us;2310&altStyle=MFE&renderOption=OverrideDefault&showPage=1&FR=1&nofrbrand=1

  • How to use JavaScript to limit the number of boxes to check the user can select a PDF form?

    How to use JavaScript to limit the number of boxes to check the user can select a PDF form?

    Here's the working solution

    Please rename all the boxes like chkBox0, chkBox1... .chkBox30 (must start with 0)

    Value of exports of each checkbox must be "Yes" (default value is Yes)

    Place this Code at the level of the Javascript Document

    -Code JavaScript document-

    var counter = 0;                Checked the meter

    -Count boxes checked again when the document is closed and reopened.

    for (var i = 0; i)<= 30;="">

    If (getField("chkBox"_+_i).value == 'Yes') {}

    Counter += 1;

    }

    }

    -The function of validation-

    function validateCheckBox(name,value) {}

    If (value == 'Yes' & meter)<>

    Counter += 1;

    } else if (value == 'Off') {}

    counter = 1;

    } else {}

    getField ("name") .value = "Off";

    App.Alert ("you can select only four checkboxes");

    }

    }

    -End of Document Javascript-

    Now put this line in the MouseUp event all checkboxes

    Box - Code MouseUp event.

    validateCheckBox (event.target.name, event.target.value);

    //----------------------------------------------------------------------------------

    Hope this will help

    Kind regards

    Post edited by: Mohammad Irfan

  • Need to limit the number of columns

    When a tab in the last cell of the row, I want the cursor to the next line down. Instead, it creates a new useless column. Can't seem to find a setting that allows me to limit the number of columns in a page - someone ' one knows how to do this?

    Thanks for your wisdom shared, Oh wise Ones.

    I'm not aware of do what you want.  You can post your comments directly to Apple using the menu item "numbers > provide Feedback numbers.

    You can still use the key combinations:

    < command > + < right arrow > to access at the end of a line

    < command > + < left arrow > to move to the beginning of a line

    < command > + < down > to pass at the end of a column

    < command > + < arrow > to move to the beginning of a column

  • How can I limit the number of Web sites on the new tab page?

    Is there a setting where I can limit the number of thumbnails / Web sites that appear on the new tab page? When I opened a new tab - I don't want to see tons of sites I have visited - but also, I don't want to delete them all. For example - there is a setting where the new tab page displays the last ten sites I've visited - with all my pinned sites?

    There are two settings 'hidden' for this 'grid '.

    Browser.newtabpage.Columns

    and

    Browser.newtabpage.Rows

    Type of topic: config in the URL bar and press ENTER.

    So put . browser.newtabpage in the top search bar.

    Each of these preferences in the lower panel right-click and select Edit. Then change the value default of 3 for each of these preferences to what you prefer, for "pinned" both sites all browsing history you want to appear in the 'grid '.

  • How to limit the number of download

    When I download many files (files of 30 to 50 at a time), firefox gets as many downloads at the same time as possible (6-7 siml dwlds). I want to limit the number of simultaneous download of 2-3. could not find the option for that. I need beak FFox occupies all the connections and I can't use any other internet stuff on this day.

    You can install an add-on to do this work for you.
    Search for download heremanagers.

    E.g. DownThemAll

  • Is it possible to limit the number of windows that can be opened?

    Original title: options in window 7

    I have an autistic son who likes to play on the internet (usually from sesame street, Barney and AFV videos on you tube).  The problem I have is that it will sometimes open many windows which eventually slows down the computer and results in me having to close the windows as well as his frustration.  Is it possible to limit the number of windows that can be opened?

    Hi Brian,.

    Thanks for posting your question in the Microsoft Community. It seems that you need more information to improve the performance of your computer.

    With the current configuration of Windows, there is no option to limit the number of windows that can be opened. You can search the 3rd application using your favorite search engine, which helps you to limit the number of windows that can be opened.

    Warning: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Link reference for more information.

    8.1 Windows, Windows 8 or Windows 7 crashes or freezes.

    http://support.Microsoft.com/kb/2681286/en-us

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    I hope this helps. Please let us know if you need assistance.

  • How to limit the number of checkboxes

    I use Adobe Pro XI and that you have a form with 15 boxes.  I need to be able to limit the total number of boxes allowed to 10, so once they checked 10 boxes, they cannot select all the others in this section.  Y at - it a calculation or script anything else that I can use to achieve this?

    Here's an approach you can take: How can I limit the number of boxes the user can select? (PDF Forms)

  • Get the number of items in a collection

    I have an associative array that is indexed by VARCHAR2. I want to know the number of items in the collection that have value of index like '% IMSI_ '. Is there a direct way to achieve this, or I have to loop through the collection and get the number in a variable. I use 11g.

    The Count() method gives the total number of elements in the array (including null values).

    If you want to count how many names or values correspond to a filter predicate, you must do it manually.

  • limit the number of values, you can choose in the filter

    Hi all

    Is there a way to limit the number of values, we can check in the filter response obiee? for instance in the status column, can we put the limit that only 5 States can be selected in the response of obiee.

    Appreciate your suggestions.

    Thank you

    Sushil

    Not sure it works but around something like;

    Give a note about only 5 values considered in the report;

    in the report use this column, filter on rcompte rcompte<>

  • limit the number of query results for content Presenter CMIS

    Hi dear,

    I have a problem. I added content present on my page in Jdev ide, not at run time. And I need a query including the limitation of the number of results.

    My query is: ${' SELECT * from ora: t:IDC:GlobalProfile WHERE the ora: p:xRegionDefinition =-"CSGMNEWS_REGDEF\" ORDER BY ora: p:dInDate DESC'}


    I just want to add a number parameter.

    Can you help me please? How can I limit the number of results?

    Kind regards

    Yacouba

    Published by: erdo on 21.Mar.2013 18:37

    Hello.

    Content Presenter has a setting (maxResults) to set the maximum returned results:

    Sample:

    xmlns = "http://xmlns.oracle.com/adf/controller/binding" Refresh 'ifNeeded' = >







    When you add your CP to a page at design time, you can access the pageDefinition and provide more values for attributes of CP.

    I hope this help you.

    Kind regards.

  • Limit the number of CMIS query results

    Hello
    Can we limit the number of CMIS query results
    my query is
    SELECT * from ora: t:IDC:GlobalProfile WHERE the ora: p:xRegionDefinition AS \'ALERTRD\'
    I want only newer 2 alerts to display.

    Thank you

    You use the CMIS query in a workflow of presenter content in WebCenter Portal? These documents provide a maxResults parameter to set.

  • Count the number of items in a list separated by commas of the values

    Hello friends,

    I have a string with a list of so-called values comma separated

    String v = 34343, erere, ererere, sdfsdfsdfs, 4454, 5454, dsfsdfsfsd, fsdfsdfsdfs, dfdsfsdfsdfs, sdsfdsf, ererdsdsd45454, Sylvie

    You want to count the number of items exist in this string.

    Thank you/Kumar

    Came to my mind as well.
    But I guess I'm typing too slowly, I had other options ran just a second there are tow:

    SQL> with t as (
      2  select  '34343,erere,ererere,sdfsdfsdfs,4454,5454,dsfsdfsfsd,fsdfsdfsdfs,dfdsfsdfsdfs,sdsfdsf,e
    rerdsdsd45454,fsdfsdfs' str from dual
      3  )
      4  --
      5  --
      6  --
      7  select length(str)-length(replace(str, ','))+1
      8  from   t;
    
    LENGTH(STR)-LENGTH(REPLACE(STR,','))+1
    --------------------------------------
                                        12
    
    SQL> with t as (
      2  select  '34343,erere,ererere,sdfsdfsdfs,4454,5454,dsfsdfsfsd,fsdfsdfsdfs,dfdsfsdfsdfs,sdsfdsf,e
    rerdsdsd45454,fsdfsdfs' str from dual
      3  )
      4  --
      5  --
      6  --
      7  select count(*)
      8  from ( select regexp_substr(str, '[^,]+', 1, rownum)
      9         from   t
     10         connect by level <= length(regexp_replace(str, '[^,]+'))+1);
    
      COUNT(*)
    ----------
            12
    
  • Limit the number of console sessions

    Hi all

    Is it possible to limit the number of the Console of the VM by VM session?  At work, my team all have access to the same virtual machine, but sometimes if I work within a certain VM, I don't want others to access the VM console even while I work in it.  Is it possible to limit the number of session up to 1?

    Thank you.

    You can edit vmx virtual machine with RemoteDisplay.maxConnections = 1 for a session or another number you want. Changes can be made by editing the virtual machine and select the Options tab and select general and click on Configuration settings...

Maybe you are looking for