How to populate second combo box on the basis of first combo

Hi All,
Please help me on populating the second combo on the basis of the selected value from first combo.
The values will come from database.
I am using struts and jsp in JBOSS
Regards,
Dinesh

Here's a snippet from one of my jsp's:
        TestDel del = new TestDel();
     String groups = del.getTestGroupsAsHTMLSelect(
                      model.getSponsorId(),
                      "groupCode",            //field name
                      null != values ? (String)values.get("groupCode") : "",                      // selected
                      "findTestTypes"); // on change       
       String tests = del.getTestsAsHTMLSelect(
                      null != values ? (String)values.get("groupCode") : "",
                      "test_code",
                      null != values ? (String)values.get("test_code") :"",
                      "findSchoolType");It basically returns a select box with the on change attribute set to do what your other reply was talking about. Using AJAX to retrieve the data and then pop it into the page...
I did find that that with mozilla there was some refreshing issue so here's some javascript help:
function findTestTypes(grp){
  var url = "/tests/lookup?cmd=test&gc="+grp.value;
     if (window.XMLHttpRequest) {
            req = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            req = new ActiveXObject("Microsoft.XMLHTTP");
     req.open("GET", url, true);
     req.onreadystatechange = showTestTypes;
     req.send(null); 
function showTestTypes(){
     if (req.readyState == 4 && req.status == 200) {
         var html = req.responseText;
         var tt = getItem("tests");
         tt.innerHTML = html;
         fireChangeEvent("test_code");
// for mozilla
function fireChangeEvent(fieldName){
         if (window.ActiveXObject) {
              getItem(fieldName).fireEvent('onchange');
         }else{
                 // target is some DOM node on which you wish to fire an event.
               var target = getItem(fieldName);
               var oEvent = document.createEvent( "Events" );
               oEvent.initEvent(
                 "change",    // the type of mouse event
                 true,       // do you want the event to
                             // bubble up through the tree?  (sure)
                 true,       // can the default action for this
                             // event, on this element, be cancelled? (yep)
                 window,     // the 'AbstractView' for this event,
                             // which I took to mean the thing sourcing
                             // the mouse input.  Either way, this is
                             // the only value I passed that would work
                 1,          // details -- for 'click' type events, this
                             // contains the number of clicks. (single click here)
                 1,          // screenXArg - I just stuck 1 in cos I
                             // really didn't care
                 1,          // screenYArg - ditto
                 1,          // clientXArg - ditto
                 1,          // clientYArg - ditto
                 false,      // is ctrl key depressed?
                 false,      // is alt key depressed?
                 false,      // is shift key depressed?
                 false,      // is meta key depressed?
                 0,          // which button is involved?
                             // I believe that 0 = left, 1 = right,
                             // 2 = middle
                 target           // the originator of the event
                             // if you wanted to simulate a child
                             // element firing the event you'd put
                             // its handle here, and call this method
                             // on the parent catcher.  In this case,
                             // they are one and the same.
               target.dispatchEvent( oEvent );        
}

Similar Messages

  • Populating second select box on the basis of first.

    Hello
    I want to populate second select box based upon the value selected in first select box from database.The second select box should be in disabled state first and should be enabled only if i select from first selct box. I want to make it by using simple JSp not ajax.

    Hello
    I want to populate second select box based upon the value selected in first select box from database.The second select box should be in disabled state first and should be enabled only if i select from first selct box. I want to make it by using simple JSp not ajax.

  • How to populate a context node on the basis of the values in another node?

    Hi,
    I have a Webdynpro application which has to run on Portal as well as BlackBerry.
    In this application I have a scenario where I need to have a sub node inside a node but as Blackberry doesn't support sub nodes with Singleton value false, I have to use another node for storing the values which earlier wre present in the sub node.
    The actual scenario here is that we have two tables A & B. For each row of table A we have a no of rows in table B. This can be easily accomplished for Web Browser but we need to do this for Blackberry.
    My question here is that how can i populate the data in table B at runtime using the concept of onLeadSelect. I am not able to fully undersans this concept.
    According to my approach I have two a while loop which generates data for  table A and inside this while loop I have another while which generates data for table B corresponding to each iteration of the outer while loop. I create the node elements for the rows of the table B and store them in a list and then store this list in a HashMap corresponding to a key formed by combining the values of all the elements of the row of table A.
    Now I am not able to understand how can I display this data into table on user slecting a particular row.
    Please guide ASAP.
    It wille quite useful if you can provide me with some code snippets for the same.
    Thanks in advance!
    Manish

    Hi Manish,
             In WebDynpro u can use the onLeadSelect event of table A and do all the processing in that method.Like u can use this method to fill ur context node,which will be the source node for table B. So this way u need not to use any hash map.Fill the source node of table B with data corresponding to ur selected data of table A.
      I hope this solution wud help u in solving ur problem.
    Reena

  • How to populate a list box linked to selection in combo box?

    Hi All,
    I am a beginner in Xcelsius. I am having problem on how to populate a list box based on the selection on my combo box.
    I have a combo box and a list box.  The combo box value consist of Countries. Values are:
    Singapore
    Indonesia
    Thailand
    When I select, for i.e. Indonesia, I want to populate the list box with all the Postal Code of Indonesia. When I select Thailand, i want to do the same.
    Can anyone shed some lights on how to achieve this?
    My spreadsheet data is as follow
    Country         Postal Code
    Singapore     680123
    Singapore     680124
    Singapore     680125
    Indonesia     155123
    Indonesia     155124
    Indonesia     155125
    Indonesia     155126
    Thailand       333123
    Many Thanks,
    Harianto

    Hi,
    I am detailing the complete steps below:
    In the combobox select the entire range of Country while seeing the records from the Combobox, Xcelsius will automatically show the unique values in the selection.
    After that in the "Data Insertion" section for Combobox select the "Insertion Type" as "Filtered Rows" (please click on the question mark beside this option and it will show how the selection works).
    In the source select the postal code, in the destination select the range which will be used as a data source for the list box.
    This will resolve the concern. Please remember to select the question mark beside the "Insertion Type" option, it explains the working in specific details.
    Best of luck.
    Regards,
    Gourav

  • How to add a text box in the layout (View)

    How to add a text box in the layout (View)

    Hi.
    Right Click in the RootUIElement container.
    Click Insert Element.
    Give Name: Input
    Type : Input Field.
    Press Enter.
    Regards
    Bala.

  • How to get a check box on the selection screen

    Hi all
    can any body tell me how to get a check box on the selection screen

    parameter: pa_check   as checkbox.
    To define the input field of a parameter as a checkbox, you use the following syntax:
    PARAMETERS <p> ...... AS CHECKBOX ......
    Parameter <p> is created with type C and length 1. In this case, you may not use the additions TYPE and LIKE. Valid values for <p> are ' ' and 'X'. These values are assigned to the parameter when the user clicks the checkbox on the selection screen.
    If you use the TYPE addition to refer to a data type in the ABAP Dictionary of type CHAR and length 1 for which 'X' and ' ' are defined as valid values in the domain, the parameter automatically appears as a checkbox on the selection screen.
    REPORT DEMO.
    PARAMETERS: A AS CHECKBOX,
    B AS CHECKBOX DEFAULT 'X'.

  • BDC uploading on the basis on first row

    hi experts,
    my requirement is, i have a flat file in excel with csv format, and i have the details of bank details with company name and debit account number and etc., in the first row,
    and from second row all the transactions done in that debit account had followed.
    my requirement is debit account is having hyphens in the number like,
    011-222545-434, i need to remove those hyphens and need to move to single string.
    like 011-222545-434 = 011222545435
    and then based on this, we need to check it out whether this number is available in the database of SAP, if it matches then,
    we need upload all the transactions under this account had to upload into database from the second row.
    so please help me out, how to remove hyphens and how to move to one string and how to validate with the sap system??
    and after this how to upload the data into database from the second row on the basis of first row details??
    it is very urgent, please help me out
    murali.

    Hi Check out this logic. It will work for ur requirement.
    DATA: w_data(20) TYPE c VALUE '011-222545-434'.
    WRITE:/1 'Before replacing', w_data.
    REPLACE ALL OCCURRENCES OF '-' IN w_data WITH space.
    CONDENSE w_data.
    WRITE:/1 'After replacing', w_data.
    If ur variable which hold this number is not character type then pass that value to character variable like above and then use REPLACE statement.
    Thanks,
    Vinod.

  • How to populate a dropdown box based on a selection in another Dropdown box.

    I am trying to find out a way to do the following:
    I am using coldfusion ....working on a form. The form has
    couple of dropdown boxes. Based on the selection on the first
    dropdown box another dropdown box needs to get populated with
    different options. These options will be coming from a query. I am
    trying to find out the Javascript code for doing this.
    Thanks in advance.

    jchopra,
    There's a method to doing what you're wanting to do that I've
    used extensively.
    Basically, within my code, I start by invoking the method
    that returns the data for the dropdown lists. Then, I use the
    following code to pour the data returned into a javascript array:
    var locArray = new Array(#evaluate(locs.recordcount+1)#);
    locArray[0] = new Array('','','','','','','','','',);
    <cfloop query="locs">
    locArray[#locs.CurrentRow#] = new
    Array('#JSStringFormat(locationId)#',
    '#JSStringFormat(fkyPolicyId)#',
    '#JSStringFormat(locationNumber)#',
    '#JSStringFormat(description)#',
    '#JSStringFormat(address1)#',
    '#JSStringFormat(address2)#',
    '#JSStringFormat(zipcode)#',
    '#JSStringFormat(city)#',
    '#JSStringFormat(state)#';
    </cfloop>
    Then I wrote a javascript function that is assigned to the
    first dropdown's onChange() event. When the user changes the value
    that is selected within the dropdown, I use javascript to locate
    (using the policyid) the corresponding record in the javascript
    array and populate and/or select the appropriate value(s) in the
    second dropdown.
    If the data returned from the method invocation is too large
    to use within a javascript array, you may need to limit the results
    that are returned.
    Hope this makes sense. If not, please let me know.
    ds

  • How can I create a box in the toolbar to dispaly cursor coordinates

    I would like to create a box in the acrobat toolbar to display cursor position coordinates relative to a user specified origin. How can this box be created and added to the toolbar? I'm just getting started with writing acrobat plugins.

    OK...
    You can create a floating palette using the ADM APIs that are documented in the SDK, and for which there are samples.
    Or use your OS platform APIs for doing windows...
    Leonard

  • How to populate multiple text boxes by selecting a value from drop down

    I apologize in advance if this is redundant, but I have searched this forum relentlessly to no avail. I have a form  connected to an MS Access database. The database is linked to another datadase on an Advantage server. This is dynamic data that has an ODBC driver allowing to link access tables to the Advantage data. Macros on access updates the table being used on this form. The livecycle form connects to the access data via a DSN on a machine that uses acrobat (not reader). This is a physician office, this form should expedite ordering radiology tests on patients. The plan is to use a drop down to select a chart number that will trigger several text boxes to populate dynamically with the corresponding demographic values like name, age, insurance etc.
    Using a data drop down I am able to select the chart number. When I used the example from the office supplies database, so that a button will trigger the event with the following code:
    if (Len(Ltrim(Rtrim(SelectField.rawValue))) > 0) then
    $sourceSet.DataConnection.#command.query.commandType = "text"
    $sourceSet.DataConnection.#command.query.select.nodes. 
    item(0).value = Concat("Select * from OfficeSupplies Where ID = ", Ltrim(Rtrim(SelectField.rawValue)) ,"") 
    I recieve a syntax error, despite adjusting quotation since I am using text rather than numeric fields.
    My question is the following:
    Is there a simple javascript that I can use to populate these text boxes (which may be read only but would be better if it allows user input)? Or does anyone recommend an alternative method? I would be happy with a link that solves this problem if someone can provide. I am somewhat familiar with js but open to any suggesstion.
    Thanks
    PS this form could also be linked to a Sequel database if that offers an advantage.

    The View object API has a setQurery() method that you can use to set the query as needed before executing it via executeQuery(). You can do this in a custom Application Module method exposed to its client interface and bound to the binding layer. You can call this method from your backing bean on a value change listener.

  • How to populate Java Beans List from the DB ?

    Hi,
    I have three tables called State,District and College.
    Assume, State table has fields statid,statename,statedescr
    District table has fields districtId,districtname,districtdescr and stateid
    College table has fields collegeid,collegename,collegedescr and districtid
    and all ids for the respective tables are primary keys .. and District and College tables have foriegn keys as expected...
    I want to send the whole information to the front end... I had designed three beans StateBean,DistrictBean and CollegeBean.. where all the three beans will have the related fiields and respective getter and setter methods like below
    StateBean -- stateid,stateName,stateDesc and DistrictBeanList
    DistrictBean -- districtid,districtName,districtDesc and CollegeBeanList
    CollegeBean -- collegeid,collegeName,collegeDesc
    I would like to have the JDBC code (any driver,any DB) so that I need to build one StateBeanList (collection of all the statebeans information) ... (like how to write the query to get the whole information from the DB and populate the same into one list..(Query or queries + resultset operation)
    I hope you understand my problem ...
    Please let me know if I have to be more clear...
    Thanks in Advance,
    Vidhya...

    Thanks Sachin,
    Atleast you understand something of my requirement..
    But Actually I want the logic like
    if the query is like
    select * from State
    while(rs.next) {
    StateBean object = new StateBean(); // StateBean
    object.yourcorrespondingsetter(rs.getString(1));
    object.yourcorrespondingsetter(rs.getString(2));
    object.yourcorrespondingsetter(rs.getString(3));
    object.setDistrictBeanList(districtbeanlistalreadypopulated); // how to populate the list of districtBeans list before ....
    listobject.add(object ); // object internally has to have districtBean list, so the district bean list has to be loaded with all the distrct Beans in which every DistrictBean will be loaded with list of CollegeBeans ... Which district belongs to which state and which college belongs which district is all there in the table information ...
    Now I want the query or queries to do that .... Can someone help me ?
    Please let me know if I have to be more clear...
    }

  • How to enable a check box using the table LVC_S_FCAT

    hi,
    I am working on reports. I have to have a check box and i am using the table LVC_S_FCAT to get the check box, i am getting the check box. how to enable it.

    Hi Preethi,
    try to set default the check-box with the
    value '0', '1', '-', ' ' and 'X' (0/1 -> only display,
    '-' field is not shown, ' ' and 'X' is normal)
    and see the differences.
    Hope it helps.
    Regards, Dieter
    Sorry, i thought you meen enable not editable.
    Message was edited by: Dieter Gröhn

  • Security Issue: How to create a derived role from the Base role

    Hi All,
    Kindly let me know how can i create a derived role from the base role?
    Please respond at the earliest.
    Thanks in advance.
    Ramesh.

    Go to PFCG and Create a role with desired Name.
    In the Description Tab, on the Left Side there is a text box for "Derive From "
    enter the Base role.
    Now your newly created role is derived from the Base role.
    Save the newly created role and again run PFCG, enter the Base role name and execute.Select Edit role. Go to Authorization tab.
    Edit Authorization.
    In the Menu Adjust Derived -> Generate and Adjust derive
    This will Generate the derived role.
    Now you may go and check the authorization in the derived role.

  • How to create a partition table on the basis of substring of column val

    Hi All,
    I have table
    Create table Mytable
    ( Col1 number,
    Col2 number,
    Col3 varchar2(20)
    insert into mytable values(11,2,'20110901');
    insert into mytable values(12,2,'20110902');
    insert into mytable values(13,2,'20110903');
    insert into mytable values(14,2,'20110904');
    insert into mytable values(15,2,'20110905');
    insert into mytable values(16,2,'20110906');
    Col3 data have the date value in the form of yyyymmdd format.
    I want to create a 30 partitions on the basis of day on col3.
    how can i achive this. i tried range partition but how can i get day of col3?
    any help appriciated.
    Edited by: P:) on Sep 28, 2011 5:56 PM

    Hi,
    the first point would be to use the correct data type for col3 and make it a date. Then I can see no reason why you couldn't range partition based on the date.
    Andre

  • ClassFileTransformer and how to transform the base class first

    Hello,
    I've written a ClassFileTransformer that uses ASM to enhance classes at load time.
    But some of the enhancements depends on possible enhancements to the super class.
    Example: under some coditions a method doWork() is inserted. This method did not exist in any class (doWork is just an example, I use a name that is not accepted by the compiler but allowed by the JLS).
      public class A {}
      public class B extends A {}If the method doWork() was inserted into class A, then the doWork() of B has to call doWork() of class A:
       super.doWork().Currently I try to load the base class by using
       loader.loadClass(superName.replace('/', '.'));this loads the super class but without passing my transformer !
    How can I solve this ?

    Looking at the comments in ClassFileTransformer.java and the code in ClassLoader, it seems the transformers are called only for class files that get a ClassFormatError. Transformers are intended to fix old broken/incompatible class files on the fly.
    I guess the intended way to do what you are doing is to define a custom class loader. Read class into byte[], transform, call defineClass() on the transformed byte[]. Google for java custom class loader for examples.

Maybe you are looking for

  • Cannot update songs in iPod

    Hi, My problem is this one: I bought an external hard drive (200 GB) I downloaded the iTunes in that external (H) drive - from Apple's site - than I transferred the songs I had in the C drive, in the H drive. I didn’t know that I should transfer the

  • How to truncate a table in oid

    do you use an interface? Thanks.

  • Questions on Open file/Quicktime format/Scratch Dish Unavailable

    Hi there, I’m brandnew to Premiere CS4 and following a video training program, but I’ve got several problem at the start : 1.       Cannot open a Premiere File in the Exercise Folder which have been copied on my desktop. I’ve also tried another appro

  • ITunes update crashed windows, no bootable hard drive

    When I went to shut down my computer last night, there was an iTunes update.  I clicked ok, then put the computer on the table.  Next thing I know, I get the dreaded blue screen with a bunch of characters, saying, I think, Windows has encountered an

  • Where to Download Dreamweaver CS6

    I have an existing license for dreamweaver cs6 and i want to transfer it in my new PC. I searched for dreamveaver cs6 installer but it always point me to dreamweaver CC. I need the CS6 not the CC installer. Thanks.