Dynamic number of Combo boxes in an applet

Hi,
I'm quite new to Java & rite now, i've an reqt to build an applet. The problem is my applet will be having a dynamic number of combo boxes in it. This number is based on the parameter passed to the applet..
any eg or references to a similar reqt would be very helpful.
Regards
-Sree Ram

Define your combo boxes dynamically and put them in a vector:
int numberOfComboBoxes = 7;
Vector comboBoxes = new Vector( numberOfComboBoxes );
for ( int i = 1; i <= numberOfComboBoxes; i++ ) {
comboBoxes.add( i - 1, new Choice() );
Now you can reference the combo boxes any time you like, no matter how many of them there are:
for ( int j = 1; i < numberOfComboBoxes; i++ ) {
System.out.println( ((Choice)comboBoxes.get( j - 1 )).getSelectedItem() );
}

Similar Messages

  • Dynamically populating a combo box in Forms

    I am having a hard time figuring out how to dynamically populate a combo box at run time. Could someone give me any ideas?
    thanks, Robin

    Use the built-in Populate_list. Read help on that and you'll know how to set it up.

  • Tab Component Dynamic Visibility to Combo Boxes

    I am using a Tab component.  I have 3 tabs on my dashboard.  I have 2 Combo boxes that I am using to filter rows of data on 3 Excel sheets.  Both Combo boxes are not used on all the tabs.  How can I pass example: User clicks on Tab 1 and use dynamic visibility for Combo Box 1 and Combo Box 2 are visible.  If the user clicks on Tab 2 I want only Combo Box 1 to be visible.

    Hi Joe,
    This can be achieved in Dynamic visibility.
    On click on Tab,just map to some target(say value "1") and then For Combo box,set target cell mapped for tab to 1,which means when the target cell gets "1",show the Combo box.
    If you are not clear then you can refer the following URL,which will give you more informations about this.
    http://everythingxcelsius.com/2008/08/tip-7-xcelsius-dynamic-visibility-video-tutorial.html
    Rgds,
    Murali

  • Dynamic values using combo box

    Hi,
    i have a doubt regarding the combo box.
    do clear it.
    Company [ ]
    bu[ ]
    onselectio of company , i should get bu values....
    i am getting the value in the bu list.......
    but the company name is not getting restored.
    giude me with the code part...
    its urgent...i need it now...
    it would kind enough if some one help me.
    thank u

    Could you provide how ur populating [bu]

  • Dynamic Update of Combo Boxes with Struts

    I need to update one dropdown box based off of the selection of the other. When I select an option I am using an onchange="reload()" to reload the page. The problem with this is as far as I can tell is only refreshing the html in the browser and not sending a new request back to the server. I have the tags bellow. If any one has any Ideas I would appreciate it.
    <bean:size id="planCount" name="new_enrollment_newEnrollmentForm" property="newEnrollmentTO.coverages[${status.index}].classPlans" scope="session"/>
    <c:choose>
         <c:when test="${planCount > 1}">
              <html:select name="new_enrollment_newEnrollmentForm" property="coverages[${status.index}].classPlanID" styleClass="coveragePlanDropDownSize" onClick="window.location.reload()" >
                        <html:option value=""/>
                        <html:options name="new_enrollment_newEnrollmentForm" property="coverages[${status.index}].classPlans" />     
              </html:select>
         </c:when>
         <c:otherwise>
              <c:out value="${coverage.classPlanID}"/>
         </c:otherwise>
    </c:choose>
    <bean:size id="volumeCount" name="new_enrollment_newEnrollmentForm" property="newEnrollmentTO.coverages[${status.index}].volumes" scope="session"/>
    <c:choose>
         <c:when test="${volumeCount > 1}">
              <html:select property="newEnrollmentTO.coverages[${status.index}].volume" styleClass="volDropDownSize">
                   <html:option value=""/>
                   <html:options name="new_enrollment_newEnrollmentForm" property="coverages[${status.index}].volumes"/>     
              </html:select>
         </c:when>
         <c:otherwise>
              <c:out value="${coverage.volume}"/>
         </c:otherwise>
    </c:choose>

    Yes, you are correct. Using the JavaScript reload() function will not submit anything to the JSP. Try something like onchange="document.forms[0].submit()" or something like that. JavaScript isn't my strong suit.
    Brian

  • Combo Box items missing

    Hi,
    I'm new to ADF and have a few basic questions.
    1)From a View Object in the Data Control Palette I dragged and dropped an attribute as Combo Box. When I run the panel no items are shown, although data is available at the database. I actually expected that ADF handels the item adding in a combo box. Is some coding really needed or what is the standard way of doing that?
    2) How can one handle dynamic displaying in combo boxes (one item selected in one box defines the items of the next one).
    Thanks.

    Hello Frank,
    thank you for your replay. Problem 1) is solved, I just had to pick the View Object and drop it as a combo box instead of the attribute itself.
    Regarding 2) I did it as follows:
    - In a JClient application I created Entity Object from two tables with 1:n relationship
    - Generated views from these EO's
    - Added those vews to my application module
    - Dragged and droppped both views in a JPanel as combo boxes
    Now what has to be reached is that by selecting one item from the first (master) combo box the items shown on the following one are only those that correspond to the Foreign Key relation.
    Thanks again
    Jan

  • How to populate the combo boxes that are created dynamically in jsp

    Hi,
    I am using JSP.
    I am creating combo boxes dynamically (based on the num selected by the user). These dynamically created combo boxes need to have A-Z as options (each box) . Now, when the user chooses the option A in any of the combo-boxes,the rest should not have this option. so on..
    how do i achieve this.Kindly help.

    You'll need to use JavaScript...I have a complicated example and a simple example, however, I cannot really understand the complex example but I know how it works. The looping is too complex for me.
    First you'll need to populate a server side variable...depending on how often the data is updated you may want this to run each time a new session is created...this example is run each time Tomcat is started and the application context is initialized:
    package kms.web;
    // Servlet imports
    import javax.servlet.ServletContextListener;
    import javax.servlet.ServletContextEvent;
    import javax.servlet.ServletContext;
    // utility imports
    import java.util.Map;
    // domain imports
    import kms.domain.LocationService;
    import kms.domain.DeptService;
    import kms.domain.PatentService;
    * This listenter is used to initialize
    * the Maps of Locations, Patents & Depts used to populate
    * pulldown lists in JSPs
    public class InitializeData implements ServletContextListener {
        * This method creates the Maps.
       public void contextInitialized(ServletContextEvent sce) {
          ServletContext context = sce.getServletContext();
          LocationService lServ = new LocationService();
          // Create the Maps
          Map campuses = lServ.getCampuses();
          Map buildings = lServ.getBuildings();
          Map floors = lServ.getFloors();
          Map locs = lServ.getLocations();
          // And store them in the "context" (application) scope
          context.setAttribute("campuses", campuses);
          context.setAttribute("buildings", buildings);
          context.setAttribute("floors", floors);
          context.setAttribute("locs", locs);
          DeptService dServ = new DeptService();
          Map depts = dServ.getDepts();
          context.setAttribute("depts", depts);
          PatentService pServ = new PatentService();
          Map patents = pServ.getPatents();
          context.setAttribute("patents", patents);
          //I did this one myself
    /*    CodeService cServ = new CodeService();
          Map masterMks = cServ.getCodes();
          context.setAttribute("masterMks", masterMks);
        * This method is necessary for interface.
       public void contextDestroyed(ServletContextEvent sce) {
       // I have no clue what the heck this is for???
       // Let me know if you do!
    }So now we travel into the PatentService method called 'getPatents();' which in turn calls a PatentDAO method
    Map patents = pServ.getPatents();
    Below is the code for the PatentService object:
    package kms.domain;
    import kms.util.ObjectNotFoundException;
    import java.util.*;
    * This object performs a variety of dept services, like retrieving
    * a dept object from the database, or creating a new dept object.
    public class PatentService {
       * The internal Data Access Object used for database CRUD operations.
      private PatentDAO patentDAO;
       * This constructor creates a Dept Service object.
      public PatentService() {
        patentDAO = new PatentDAO();
    public Map getPatents() {
          Map patents = null;
          try {
            patents = patentDAO.retrieveAll();
          // If the dept object does not exist, simply return null
          } catch (ObjectNotFoundException onfe) {
            patents = null;
          return patents;
    }It may be useful for you to see the code of the Patent class:
    package kms.domain;
    /*** This domain object represents a dept.
    public class Patent implements java.io.Serializable {
      private int codeGgm;
      private String name = "";
      private String description = "";
      private int creator;
      private String creationDate = "";
      private int used;
       * This is the full constructor.
      public Patent(int codeGgm, String name, String desc, int creator, String creationDate, int used) {
        this.codeGgm = codeGgm;
        this.name = name;
        this.description = desc;
        this.creator = creator;
        this.creationDate = creationDate;
        this.used = used;
      public Patent() { }
      public int getCodeGgm() {
          return codeGgm;
      public void setCodeGgm(int codeGgm) {
           this.codeGgm = codeGgm;
      public String getName() {
        return name;
      public void setName(String name) {
          this.name = name;
      public String getDesc() {
        return description;
      public void setDesc(String desc) {
          this.description = desc;
      public int getCreator() {
          return creator;
      public void setCreator(int creator) {
             this.creator = creator;
      public String getCreationDate() {
          return creationDate;
      public void setCreationDate(String creationDate) {
             this.creationDate = creationDate;
      public int getUsed() {
           return used;
      public void setUsed(int used){
           this.used = used;
    }And here is the Database table which stores the Patents:
    DESC PATENT:
    CODE_GGM NUMBER(3)
    NAME VARCHAR2(15)
    DESCRIPTION VARCHAR2(250)
    CREATOR NUMBER(10)
    CREATION_DATE DATE
    USED NUMBER(1)
    So, we then travel into the code of the PatentDAO to see how the DAO object executes the DB query to get all of the Data we need for the select list:
    package kms.domain;
    import javax.naming.*;
    import javax.sql.*;
    import java.util.*;
    import java.sql.*;
    import kms.util.*;
    * This Data Access Object performs database operations on Patent objects.
    class PatentDAO {
       * This constructor creates a Patent DAO object.
       * Keep this package-private, so no other classes have access
    PatentDAO() {
    * This method returns a Map of all the Dept names
    * The key is the Dept id
    Map retrieveAll()
           throws ObjectNotFoundException {
          Connection connection = null;
          ResultSet results = null;
          // Create the query statement
          PreparedStatement query_stmt = null;
          try {
            // Get a database connection
          Context initContext = new InitialContext();
           DataSource ds = (DataSource)initContext.lookup("java:/comp/env/jdbc/keymanOracle");
           connection = ds.getConnection();
            // Create SQL SELECT statement
            query_stmt = connection.prepareStatement(RETRIEVE_ALL_NAMES);
            results = query_stmt.executeQuery();
            int num_of_rows = 0;
          Map patents = new TreeMap();
             // Iterator over the query results
            while ( results.next() ) {
                patents.put(new Integer(results.getInt("code_ggm")), results.getString("name"));
             if ( patents != null ) {
                      return patents;
                    } else {
                      throw new ObjectNotFoundException("patent");
           // Handle any SQL errors
         } catch (SQLException se) {
            se.printStackTrace();
           throw new RuntimeException("A database error occured. " + se.getMessage());
        } catch (NamingException se) {
          throw new RuntimeException("A JNDI error occured. " + se.getMessage());
          // Clean up JDBC resources
          } finally {
            if ( results != null ) {
              try { results.close(); }
              catch (SQLException se) { se.printStackTrace(System.err); }
            if ( query_stmt != null ) {
              try { query_stmt.close(); }
              catch (SQLException se) { se.printStackTrace(System.err); }
            if ( connection != null ) {
              try { connection.close(); }
              catch (Exception e) { e.printStackTrace(System.err); }
    private static final String RETRIEVE_ALL_NAMES
          = "SELECT code_ggm, name FROM patent ";
    }Now when you wish to use the 'combo box' (also called select lists), you insert this code into your jsp:
    <TR>
    <%@ include file="../incl/patent.jsp" %>
    </TR>
    depending on how your files on your server are organized, the "../incl/patent.jsp"
    tells the container to look up one directory from where the main jsp is to find the 'patent.jsp' file in the 'incl' directory.
    I need some help creating multi-level select lists with JavaScript:
    Can anyone explain this code:
    <%@ page import="java.util.*,kms.domain.*" %>
    <jsp:useBean id="campuses" scope="application" class="java.util.Map" />
    <TR><TD ALIGN='right'>Campus: </TD>
    <TD>
    <select name="campus" size="1" onChange="redirect(this.options.selectedIndex)">
    <option value="0" selected>No Campus</option>
    <% LocationService ls = new LocationService();
       Iterator c = campuses.keySet().iterator();
       Map[] bm = new Map[campuses.size()];
       Map[][] fm = new Map[campuses.size()][0];
       Map[][][] lm = new Map[campuses.size()][0][0];
       int i2 = 0;
       int j2 = 0;
       int k2 = 0;
       int jj = 0;
       int kk = 0;
       while (c.hasNext()) {
          Integer i = (Integer)c.next();
          out.print("<OPTION ");
          out.print("VALUE='" + i.intValue()+ "'>");
          out.print( (String) campuses.get(i) );
          out.print("</OPTION>");
          bm[i2] =  ls.getBuildingsByCampus(i.intValue());
          fm[i2] = new Map[bm[i2].size()];
          lm[i2] = new Map[bm[i2].size()][];
          Iterator b = bm[i2].keySet().iterator();
          j2 = 0;
          while (b.hasNext()) {
            Integer j = (Integer)b.next();
            fm[i2][j2] = ls.getFloorsByBuilding(j.intValue());
            lm[i2][j2] = new Map[fm[i2][j2].size()];
            Iterator f = fm[i2][j2].keySet().iterator();
            k2 = 0;
            while (f.hasNext()) {
              Integer k = (Integer)f.next();
              lm[i2][j2][k2] = ls.getLocationsByFloor(k.intValue());
              k2++;
              kk++;
            j2++;
            jj++;
          i2++;
       } %>
    </select></TD>
    </TR>
    <TR><TD ALIGN='right'>Building: </TD>
    <TD>
    <select name="building" size="1" onChange="redirect1(this.options.selectedIndex)">
    <option value="0" selected>No Building</option>
    </select></TD>
    </TR>
    <TR><TD ALIGN='right'>Floor: </TD>
    <TD>
    <select name="floor" size="1" onChange="redirect2(this.options.selectedIndex)">
    <option value="0" selected>No Floor</option>
    </select></TD>
    </TR>
    <TR><TD ALIGN='right'>Room: </TD>
    <TD>
    <select name="location_id" size="1">
    <option value="0" selected>No Room</option>
    </select></TD>
    </TR>
    <script>
    var cNum = <%=i2%>
    var bNum = <%=jj%>
    var fNum = <%=kk%>
    var cc = 0
    var bb = 0
    var ff = 0
    var temp=document.isc.building
    function redirect(x){
    cc = x
    for (m=temp.options.length-1;m>0;m--)
      temp.options[m]=null
      temp.options[0]=new Option("No Building", "0")
      if (cc!=0) {
        for (i=1;i<=group[cc-1].length;i++){
          temp.options=new Option(group[cc-1][i-1].text,group[cc-1][i-1].value)
    temp.options[0].selected=true
    redirect1(0)
    var group=new Array(cNum)
    for (i=0; i<cNum; i++) {
    group[i]=new Array()
    <% for (int i=0; i< bm.length; i++) {
    Iterator bldgs = bm[i].keySet().iterator();
    int j = 0;
    while (bldgs.hasNext()) {
    Integer intJ =(Integer) bldgs.next(); %>
    group[<%=i%>][<%=j%>] = new Option("<%=bm[i].get(intJ)%>", "<%=intJ%>");
    <% j++;
    } %>
    var group2=new Array(cNum)
    for (i=0; i<cNum; i++) {
    group2[i] = new Array()
    for (j=0; j<=bNum; j++) {
    group2[i][j] = new Array()
    <% for (int i=0; i< fm.length; i++) {
    for (int j=0; j< fm[i].length; j++) {
    Iterator flrs = fm[i][j].keySet().iterator();
    int k = 0;
    while (flrs.hasNext()) {
    Integer intK =(Integer) flrs.next(); %>
    group2[<%=i%>][<%=j%>][<%=k%>] = new Option("<%=fm[i][j].get(intK)%>", "<%=intK%>");
    <% k++;
    } %>
    var temp1=document.isc.floor
    var camp=document.isc.campus.options.selectedIndex
    function redirect1(x){
    bb = x
    for (m=temp1.options.length-1;m>0;m--)
    temp1.options[m]=null
    temp1.options[0]=new Option("No Floor", "0")
    if (cc!=0 && bb!=0) {
    for (i=1;i<=group2[cc-1][bb-1].length;i++){
    temp1.options[i]=new Option(group2[cc-1][bb-1][i-1].text,group2[cc-1][bb-1][i-1].value)
    temp1.options[0].selected=true
    redirect2(0)
    var group3=new Array(cNum)
    for (i=0; i<cNum; i++) {
    group3[i] = new Array()
    for (j=0; j<=bNum; j++) {
    group3[i][j] = new Array()
    for (k=0; k<=fNum; k++) {
    group3[i][j][k] = new Array()
    <% for (int i=0; i< lm.length; i++) {
    for (int j=0; j< lm[i].length; j++) {
    for (int k=0; k< lm[i][j].length; k++) {
    Iterator locs = lm[i][j][k].keySet().iterator();
    int m = 0;
    while (locs.hasNext()) {
    Integer intM =(Integer) locs.next(); %>
    group3[<%=i%>][<%=j%>][<%=k%>][<%=m%>] = new Option("<%=lm[i][j][k].get(intM)%>", "<%=intM%>");
    <% m++;
    } %>
    var temp2=document.isc.location_id
    function redirect2(x){
    ff = x
    for (m=temp2.options.length-1;m>0;m--)
    temp2.options[m]=null
    temp2.options[0]=new Option("No Room", "0")
    if (cc!=0 && bb!=0 && ff!=0) {
    for (i=1;i<=group3[cc-1][bb-1][ff-1].length;i++){
    temp2.options[i]=new Option(group3[cc-1][bb-1][ff-1][i-1].text,group3[cc-1][bb-1][ff-1][i-1].value)
    temp2.options[0].selected=true
    </script>
    This produces a related select list with 4 related lists by outputting JavaScript to the page being served. It works the same way as the first example that I describe but I don't understand the looping...maybe someone could explain how to go from the single select list to a double and/or triple level drill down?

  • Dynamically change the contents of one combo box based on the other

    Hi Forum,
    I have a question which might have a possibly simple answer. Well anyway help me out since i could not find the simple answer.
    I am building an application using Swing and binding with BC4J using JClient. My GUI has combo boxes, grids, editboxes. My requirement is that i should be able to dynamically change the contents of one combo box based on the selected item in trhe previous combo box. For example, when i choose a country in the "country combo box", the "states combo box" should show the list of the states of the selected country.
    Now how do i do this using binding. If not, how do i write custom querirs in BC4J layer and return a resultset to the remote application so theat i can populate the dependent combo boxes.
    I will appreciate if anyone can help me out in this regard.
    Thank You
    Sumit

    there could be quite a few number of ways of solving this problem.
    One way is through event handlers.
    taking your example as a model when user selects a country you could fire an action with a flag set to ture. A method will return the states from the DB or your temporary files or what ever and then the true flag will be used in the states combo box rendering.
    other way: javascript
    this might be a bit clumsy as you will need the states information in a property file and you can get the info as the user selects a country.
    regards,
    raj

  • Change combo box selection dynamically?

    I would like to have a combo box change its selection dynamically according to what is selected in another selector.  As far as I can tell from reading the Help, this feature is available for List Boxes, List Views and List Builders only ("The Dynamic Selected Item functionality is available in list-based selectors") and based on the wording I assume that it is currently unavailable for other components.  Is this true?  If so I would like to formally request that other selectors - particularly combo boxes - be included.
    The use case for me is this: After the user has already inputted information and digested some of the output, they eventually reach a section of the project that appears only under certain conditions.  This area is about 800 pixels to the right of the original combo box in the inputs area, and so in order to quickly change that selection they would have to go look for the original selector, which could easily discourage them from browsing that particular selection.  Hopefully this makes sense.
    It would also be great to hear back that this kind of feature request can actually be made in this way.  I've submitted a few similar requests in the past and did not see an acknowledgment, and so I am still unclear as to whether or not feature requests are even possible.
    (Edit: I thought about creating duplicate overlapping instances of the combo boxes in question and, using dynamic visibility, control which appears according to the current selection.  But this is only suitable for smaller lists).

    >
    Alan McClean wrote:
    > To get around it I shuffled my selection list dynamically, so that the one I wanted appeared at the correct place. I did this using the source data component and some Excel logic. However, it is buggy and a lot of work.
    Thanks, Alan.  I am currently working on a similar solution.  Seems to be the best for my situation, but it is far from elegant.
    >
    Charles Davies wrote:
    > Just a thought, would the Filter component work for you?
    The Filter component requires that the underlying Excel data be structured in a pretty specific way.  As far as I can tell, I would probably have to rip apart my XLS and redesign it in order to make use of that component.  Perhaps in a future generation I'll give it a go, but I've already gone through too many redesigns this time around.

  • Problem with editable combo box and creating dynamic table values using js

    Hai
    I have used jquery.jec.js to make my dropdown list as editable... I need to create dynamic table values on the onChange event of dropdown using javascript.
    Now am facing the problem in it...
    I am getting duplicate rows in the table... think(assumption) this jquery.jec.js is calling the dropdown again creating duplicate values...
    Please help me out.... Any help is appreciable... Thanks in advance

    Thanks elOpalo, for your valuable response....
    I have found the correct way of doing.
    Before i had my code like this,
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>test</title>
    <script type="text/javascript" src="js/jquery-latest.js"></script>
    <script type="text/javascript" src="js/jquery.jec.js"></script>
    <script type="text/javascript">
    $(function(){
    $('#list').jec();
    function giveAlert(){
         alert('hello');
    </script>
    </head>
    <body>
    <form>
    Combo Box:
    <select id="list" name="list" onChange="giveAlert();">
    <option value="1">one</option>
    <option value="2">two</option>
    </select>
    </form>
    </body>
    </html>
    Now i have changed as the following,
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>test</title>
    <script type="text/javascript" src="js/jquery-latest.js"></script>
    <script type="text/javascript" src="js/jquery.jec.js"></script>
    <script type="text/javascript">
    $(function(){
    $('select.combo').jec();
    $('select.combo')
    .change(function() {
    alert($(this).val());
    }).change();
    </script>
    </head>
    <body>
    <form>
    <table>
    <tr>
    <td>Combo Box:</td>
    <td><select class="combo"><option value="b">banana</option><option value="a">apple</option></select></td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    The problem is with the function i have called on the onChange Event.. Now i have defined it inside the jquery function of dropdown to make it as editable...

  • Dynamic Combo Boxes

    Hi,
    I have an interface that has 2 combo boxes; in the first you select a product, in the second a type of that product. Now how is possible to make a dynamic changing content combobox?
    Thanks

    Replace the model of the second box with a new one. i.e. When a selection is made in the first box, use 'box.setModel(...)' and replace the current model with a new one.
    ICE

  • Dynamic LOV/Combo Box

    I need to put an LOV/Combo Box on a form where they can select a date from a list of values. We have reports that our field reps have to submit for the previous friday. I have code to create a combo box. How can I add this to a form or create a LOV with this function:
    DECLARE
         n_NumofDays NUMBER;
         testdate VARCHAR2(50);
         selectedyear VARCHAR2(50);
         firstdayofyear VARCHAR2(11);
         firstfridayofyear VARCHAR2(11);
         upcomingfriday VARCHAR2(11);
         currentdate DATE;
         thisyear VARCHAR2(50);
         selected VARCHAR2(8);
    BEGIN
         selectedyear := TO_CHAR(SYSDATE,'YYYY');
    firstdayofyear := '01-JAN-' || selectedyear;
    firstfridayofyear := NEXT_DAY(firstdayofyear, 'FRIDAY');
    upcomingfriday := NEXT_DAY(SYSDATE, 'FRIDAY');
         htp.p('<select name="weekenddate">');
         htp.p('<option selected value="'|| firstfridayofyear || '">Friday '|| firstfridayofyear || '</option>');
              currentdate := firstfridayofyear;
              thisyear := selectedyear;
              x :=0;
         WHILE SelectedYear = ThisYear LOOP
         IF currentdate = upcomingfriday THEN
              selected := 'selected';
         ELSE
              selected :='';
         END IF;
         htp.p('<option '|| selected || ' value="'|| currentdate || '">Friday '|| currentdate || '</option>');
              currentdate := NEXT_DAY(currentdate, 'FRIDAY');
              thisyear := TO_CHAR(currentdate,'YYYY');
         END LOOP;
         htp.br;
         htp.p('</select>');
    htp.br;
    htp.p(n_NumofDays);
    END;
    Look forward to your answer.

    Rebecca:
    This is the standard call for a Portal-built form:
    PORTAL.wwa_app_module.link (
    p_arg_names => PORTAL.wwv_standard_util.string_to_table2('_moduleid:loc_code'),
    p_arg_values => PORTAL.wwv_standard_util.string_to_table2('2728668008:BHM'));
    The 1st parm is required, it id's the form to call; the 2nd parm, LOC_CODE, I'm having to hard-code. It relates to the specific page from where this form is called; therefore, I've several places throughout the site where I call this form and the LOC_CODE value is different. I've a field on on this form that gets populated with this value when the form comes-up, but I have it hidden. I can also use this value to drive the contents of a combo-box on the form. That's what I really needed to do; restrict the selection there based on where the form was being called from.
    Hope that helps...
    Ed in Tampa

  • Need help dynamically building combo-boxes...

    How can I dynamically build drop down lists?
    I was thinking about using a dynamic page, with bind variables
    set for sql statements inside <oracle></oracle> tags, or passing
    the variable from the first selection to the second selection of
    another page (or the same page?)...
    Another thing I was thinking about would be to base a form on a
    DB procedure, and pass the selections to the procedure, and re-
    build the lists that way...
    I need to avoid client side processing (javascript) because of
    accessiblity concerns.
    Any ideas would be greatly appreciated...
    Ryan

    Ajay,
    The following is an excerpt of the code I used. Because of a
    lack of time, I haven't made the code generic. The code is used
    to interface with Oracle Reports 6i & Oracle Configurator. The
    configurator (config_hdr_id & config_rev_nbr) parameters are
    selected by the user and passed into Oracle Reports using related
    dynamic combo-boxes. Pay particular attention to the
    wwpro_api_parameters.get_value function as well as the onChange
    javascript. Hope you can take pieces of this for an example.
    The following is the code for a Portal dynamic page:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <title>Configurator Reports</title>
    <SCRIPT LANGUAGE="JavaScript1.1">
    <!-- Comment out script for old browsers
    ** this function will open a new URL for the Reports CGI
    ** executable to run the report
    function runReport()
    // semi-constants for JavaScript
    var cgiexe = "runrep.sh";
    var slash = "/";
    var colon = ":";
    var qmark = "?";
    var paramsep = "&";
    ** URL parameter values
    ** We should check for nulls, http://, etc. but not for now
    var dtlist = document.REPFORM.WEBHOST;
    var WEBHOST = dtlist.options[dtlist.selectedIndex].value;
    var WEBPORT = document.REPFORM.WEBPORT.value;
    var dtlist = document.REPFORM.SERVER;
    var SERVER = dtlist.options[dtlist.selectedIndex].value;
    var dtlist = document.REPFORM.REPORT;
    var REPORT = dtlist.options[dtlist.selectedIndex].value;
    var dtlist = document.REPFORM.P_HEADER_ID;
    var P_HDR_ID = dtlist.options[dtlist.selectedIndex].value;
    var P_REV_NBR = document.REPFORM.P_REV_NBR.value;
    var dtlist = document.REPFORM.USERID;
    var USERID = dtlist.options[dtlist.selectedIndex].value;
    var dtlist = document.REPFORM.DESTYPE;
    var DESTYPE = dtlist.options[dtlist.selectedIndex].value;
    var dflist = document.REPFORM.DESFORMAT;
    var DESFORMAT = dflist.options[dflist.selectedIndex].value;
    var dtlist = document.REPFORM.MIMETYPE;
    var MIMETYPE = dtlist.options[dtlist.selectedIndex].value;
    // construct the final URL given the parameters
    var URL = "http://" + WEBHOST + colon + WEBPORT +
    "/dev60cgi/"
    + cgiexe + qmark +
    "server=" + SERVER + paramsep +
    "report=" + REPORT + paramsep +
    "p_header_id=" + P_HDR_ID + paramsep +
    "p_rev_nbr=" + P_REV_NBR + paramsep +
    "userid=" + USERID + paramsep +
    "destype=" + DESTYPE + paramsep +
    "desformat=" + DESFORMAT + paramsep +
    "mimetype=" + MIMETYPE;
    // alert("Opening a window with the following URL : \r\r" +
    URL);
    // open the new window with the constructed URL
    //runWindow = window.open(URL);
    //Point the current window to the URL to run the form
    this.window.location.href=URL;
    function getRevision(form)
    var l_config_hdr_id =
    form.P_HEADER_ID.options[form.P_HEADER_ID.selectedIndex].value;
    window.location.href =
    "/pls/portal30/!PORTAL30.wwpob_page_util.redirect?_pageid=61&_tab
    string=&_portletmode=&_cache=1&cz.p_config_hdr_id="+l_config_hdr_
    id;
    return false;
    //-->
    </SCRIPT>
    </head>
    <body>
    <form NAME="REPFORM" METHOD="GET" onSubmit="return false">
    <table BORDER=0 CELLSPACING="5" valign="top" align="left">
    <tr>
    <td ALIGN=LEFT COLSPAN="2"><font face="arial" size="-1"><B>Enter
    configuration data and click the button to submit the selected
    report.</B></font></td>
    </tr>
    <TR><TD> </TD></TR>
    <tr><td valign="top"><table BORDER=0 CELLSPACING="2">
    <TR><TD COLSPAN="3" ALIGN="LEFT">
    <FONT COLOR="#6666CC" FACE="arial,helvetica"
    SIZE="-1"><NOBR><B>Report Parameters</B></NOBR></FONT>
    </TD></TR>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Report:</font></td>
    <td><font face="arial" size="-1"><select NAME="REPORT">
    <option SELECTED
    VALUE="portal_test_report_6i.rdf">portal_test_report_6i.rdf
    </select></font></td>
    </tr>
    <ORACLE>
    -- Dynamically retrieving the Configurator Header ID's.
    -- kreierso 8-oct-01
    declare
    v_config_hdr_id oc_config_ord_qte_lookup.config_hdr_id%type;
    begin
    v_config_hdr_id :=
    to_number(portal30.wwpro_api_parameters.get_value('p_config_hdr_i
    d','cz'));
    htp.p('<TR><TD ALIGN="left"><font face="arial"
    size="-1">Configuration Header ID:</font></TD>');
    htp.p('<TD><font face="arial" size="-1"><SELECT
    NAME="P_HEADER_ID" onchange="getRevision(this.form)">');
    htp.p('<OPTION VALUE=" "> ');
    for r_get_hdr_values in (
    select cz.config_hdr_id, cz.config_rev_nbr
    from cz_config_hdrs cz
    order by cz.config_hdr_id desc
    ) loop
    if v_config_hdr_id = r_get_hdr_values.config_hdr_id then
    htp.p('<OPTION SELECTED
    VALUE="'||r_get_hdr_values.config_hdr_id||'">'||r_get_hdr_values.
    config_hdr_id);
    else
    htp.p('<OPTION
    VALUE="'||r_get_hdr_values.config_hdr_id||'">'||r_get_hdr_values.
    config_hdr_id);
    end if;
    end loop;
    htp.p('</SELECT></font>');
    htp.p('</TD></TR>');
    htp.p('<TR><TD ALIGN="left"><font face="arial"
    size="-1">Configuration Revision:</font></TD>');
    htp.p('<TD><font face="arial" size="-1"><SELECT
    NAME="P_REV_NBR">');
    for r_get_rev_values in (
    select cz.config_rev_nbr
    from cz_config_hdrs cz
    where cz.config_hdr_id = v_config_hdr_id
    order by cz.config_rev_nbr desc
    ) loop
    htp.p('<OPTION
    VALUE="'||r_get_rev_values.config_rev_nbr||'">'||r_get_rev_values
    .config_rev_nbr);
    end loop;
    htp.p('</SELECT></font></TD></TR>');
    end;
    </ORACLE>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Format:</font></td>
    <td><font face="arial" size="-1"><select NAME="DESFORMAT">
    <option SELECTED VALUE="RTF">RTF
    <option VALUE="PDF">PDF
    <option VALUE="HTML">HTML</select></font></td>
    </tr>
    <tr><td> </td></tr>
    <tr>
    <td ALIGN=RIGHT><FONT face="arial" size="-1"><input TYPE="SUBMIT"
    NAME="Runrep" VALUE="Run Report"
    onClick="runReport();"></FONT></td>
    <td ALIGN=RIGHT><FONT face="arial" size="-1"><input TYPE="RESET"
    NAME="Reset" VALUE="Reset"></FONT></td>
    </tr>
    </table></td>
    <td valign="top"><table BORDER=0 CELLSPACING="2">
    <TR><TD COLSPAN="3" ALIGN="LEFT">
    <FONT COLOR="#6666CC" FACE="arial,helvetica"
    SIZE="-1"><NOBR><B>Report Paremeters (Hidden
    Candidates)</B></NOBR></FONT>
    </TD></TR>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Userid:</font></td>
    <td><font face="arial" size="-1"><select NAME="USERID">
    <option SELECTED
    VALUE="kreierso/password@DEV11">kreierso/password@DEV11
    </select></font></td>
    </tr>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Type:</font></td>
    <td><font face="arial" size="-1"><select NAME="DESTYPE">
    <option SELECTED VALUE="cache">cache
    <option VALUE="Printer">printer
    <option VALUE="File">file
    </select></font></td>
    </tr>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Mimetype:</font></td>
    <td><font face="arial" size="-1"><select NAME="MIMETYPE">
    <option SELECTED VALUE="application/msword">application/msword
    </select></font></td>
    </tr>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Reports
    Server:</font></td>
    <td><font face="arial" size="-1"><select NAME="SERVER">
    <option SELECTED
    VALUE="Rep60_dev11_shane.dci.com">Rep60_dev11_shane.dci.com
    </select></font></td>
    </tr>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Web Host:</font></td>
    <td><font face="arial" size="-1"><select NAME="WEBHOST">
    <option SELECTED VALUE="shane.dci.com">shane.dci.com
    </select></font></td>
    </tr>
    <tr>
    <td ALIGN=LEFT><font face="arial" size="-1">Web Port:</font></td>
    <td><font face="arial" size="-1"><input type=hidden
    NAME="WEBPORT" VALUE="7500">7500</font></td>
    </tr>
    </td></tr></table>
    <TR><TD> </TD></TR>
    <TR><TD ALIGN="CENTER" COLSPAN="2">
    <font face="arial" size="+1" color="#000099">This is currently
    being developed.... ~Thanks, Kirk.</font>
    </TD></TR>
    </table>
    </form>
    </body>
    </html>

  • Needs multi column dynamic combo box using C#

    I need a dynamic Combo box to display multi columns on Drop Down Event 
    such as Stock Code, Make, Model,Sub Model, Measurement Type and so on for  my C# Application with Columns Headers 
    Please Help Me
    Thanks in Advance

    You should create a class that represents your model and then you could use a CompositeCollection as the ItemsSource of the ComboBox.
    Here is an example for you:
    namespace WpfApplication59
    public class YourModel
    public string StockCode { get; set; }
    public string Model { get; set; }
    //+ the rest of your properties
    MainWindow.xaml.cs:
    public partial class MainWindow : Window
    public MainWindow()
    InitializeComponent();
    List<YourModel> models = new List<YourModel>();
    models.Add(new YourModel() { Model = "m1", StockCode ="c1"});
    models.Add(new YourModel() { Model = "m2", StockCode = "c2" });
    cb.ItemsSource = models;
    MainWindow.xaml:
    <ComboBox x:Name="cb" Grid.IsSharedSizeScope="True" ItemsSource="{DynamicResource items}"
    xmlns:local="clr-namespace:WpfApplication59">
    <ComboBox.Resources>
    <CompositeCollection x:Key="items">
    <ComboBoxItem IsEnabled="False">
    <Grid TextElement.FontWeight="Bold">
    <Grid.ColumnDefinitions>
    <ColumnDefinition SharedSizeGroup="A"/>
    <ColumnDefinition Width="5"/>
    <ColumnDefinition SharedSizeGroup="B"/>
    </Grid.ColumnDefinitions>
    <Grid.Children>
    <TextBlock Grid.Column="0" Text="Model"/>
    <TextBlock Grid.Column="2" Text="Stock Code"/>
    </Grid.Children>
    </Grid>
    </ComboBoxItem>
    <Separator/>
    <CollectionContainer Collection="{Binding Source={x:Reference cb}, Path=DataContext}"/>
    </CompositeCollection>
    <DataTemplate DataType="{x:Type local:YourModel}">
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition SharedSizeGroup="A"/>
    <ColumnDefinition Width="5"/>
    <ColumnDefinition SharedSizeGroup="B"/>
    </Grid.ColumnDefinitions>
    <Grid.Children>
    <TextBlock Grid.Column="0" Text="{Binding Model}"/>
    <TextBlock Grid.Column="2" Text="{Binding StockCode}"/>
    </Grid.Children>
    </Grid>
    </DataTemplate>
    </ComboBox.Resources>
    </ComboBox>
    You could restyle the the templates (Grids) as per your requirements.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.

  • Help needed on combo-box dynamic values??

    Hi ,
    i need to populate values in 2 combo-boxes where the values
    in the second combo is dependent on the first .. from db ...
    i.e if i select a value in 1 combo then the values in the second combo should be populated accordingly from the db..
    pls suggest on this.

    You can use onchange event of the first combo box, then you can submit a form sending the first combo box value, then response filling the second combo box.
    If you don't want to make a request, you should use ajax to get data from database.

Maybe you are looking for