Dynamic changes of option tags in a Select tag using JavaScript

I got this problem during my project.
I used Select tag in HTML code.
I have to change options related to Select tag, based on events.
How can we change options dynamically using JavaScript?
Please post solution to this problem..

You know Sun Java Studio Enterprise forum isn�t a right place for JavaScript & HTML questions.
BTW here is you can find a lot of js stuff: docs, samples, tutorials, etc:
http://www.w3schools.com/js/default.asp

Similar Messages

  • Changing a select list using javascript

    Hi all,
    yesterday I had a doubt using apex_item.checkbox and how to change them using javascript:
    Re: Passing a checkbox as a parameter to a javascript function
    Today, I'm facing a similar problem, but with select lists. Here it goes. I have a report with apex_items, like this:
    select
    apex_item.checkbox(1,"ID",NULL,NULL,NULL,'f01_#ROWNUM#') " ",
    apex_item.select_list_from_lov(2,"SW_STATUS",'F2010051_SET_STATUS','onChange="setItems(''f01_#ROWNUM#'',''f03_#ROWNUM@'')"','NO') sTATUS,
    apex_item.select_list_from_lov(3,"REVISIO",'F2010051_SET_REVISIO',NULL,'NO','f04_#ROWNUM#') "REVISIO"
    from Fx1_vThe javascript code is as follows:
    <script type="text/javascript">
    function setItems(cb,estat){
      elem = $x(cb);
      alert(elem.value);
      $x(cb).checked = true;
      elem2 = $x(estat);
      alert(elem2.value); 
    </script>The idea is that everytime the item g_f02 (a select list) changes, calls the JS function with two parameters: a checkbox (g_f01) and another select list (g_f03). The function should change the items to a defined values. The checkbox changes ok thanks to the help I got yesterday, but I can't work with the third item (select list g_f03). When I try to show the value, it says "undefined".
    how could I see the actual value of the select list LOV and change it to 1, for example?
    Thank you very much, any help will be appreciated!!!
    Edited by: Elena.mtc on 19-may-2011 8:11

    Hi,
    Do you have typo in query?
    Should it be
    select
    apex_item.checkbox(1,"ID",NULL,NULL,NULL,'f01_#ROWNUM#') " ",
    apex_item.select_list_from_lov(2,"SW_STATUS",'F2010051_SET_STATUS','onChange="setItems(''f01_#ROWNUM#'',''f03_#ROWNUM#'')"','NO') sTATUS,
    apex_item.select_list_from_lov(3,"REVISIO",'F2010051_SET_REVISIO',NULL,'NO','f04_#ROWNUM#') "REVISIO"
    from Fx1_vAnd JavaScript
    <script type="text/javascript">
    function setItems(cb,estat){
      elem = $x(cb);
      alert(elem.value);
      $x(cb).checked = true;
      elem2 = $x(estat);
      alert(elem2.value); 
      $s(elem2,1); // $s function is for changing item value
    </script>Regards,
    Jari

  • Dynamically changing dropdown options in JCombox cell editor

    Hi all,
    I have a JTable with one column with JComboBox renderer and i am using the cell editor for that column as new DefaultCellEditor(JComBoBox renderer class).
    My requirement is i want to change the dropdown options basing on another column value.
    So what i did is in the setValueAt(...) function i got the table column renderer and as send the new values in a object to the renderer and in the getTableCellRendererComponent method i am checking the row number and setting the dropdown options to the JComboxBox. This works fine and the JComboBox is showing the new dropdown options correctly but when i click on the JcomboxBox cell it is showing the old dropdown options.
    So my question is how can i change the values in the editor.
    I tried like this in my setValueAt(..) functioin in my JTable model
    ( (my custom class) ((DefaultCellEditor) table.getColumnModel.getColumn(int)).getComponent).add(NewObject)
    in the new object i am sending new dropdown values and row and column but it some how it is updating renderer but not editor. Please give me the solution
    Thanks in advance
    Sunil

    You can extend DefaultCellEditor the same way as you extend cell renderer.
    After that you can set it back to your table using table.setCellEditor() method.
    best regards
    Stas

  • Getting dynamic id of a component bound to a datatable, using javascript

    Hi....
    I am using Sun Studio Creator to develop a small application.
    I have a problem in getting the dynamic id of a component in Javascript, which is bound to a column of a datatable.
    In the jsp page, I have a datatable and it is bound to a list in the backing bean.The datatable has 2 columns.One column is a checkbox and the other column is a dropdownlist. The values of the checkbox and the dropdown are taken from the list for a button click.The list data are taken from database.Now, I want to enable/disable the dropdownlist according to the check box value(the user checks/unchecks) and I want to do it on the change/onclick of the checkbox.That is, I want to get the dynamic id of the check box in a Javascript. I tried using the j4j idProxy as well. But that also failed to help me.
    In Javascript,
    function changeCheckboxValue() {
    var i = document.getElementById('checkboxStatus').title;
    alert(i);
    This alert message is "undefined".
    In jsp,
    <h:column binding="#{AssignVals.column1}" id="column1">
    <h:selectBooleanCheckbox binding="#{AssignVals.checkbox1}" id="checkbox1"
    onchange="changeCheckboxValue()" value="#{currentRow['status']}">
    <j4j:idProxy id="checkboxStatus" />
    </h:selectBooleanCheckbox>
    </h:column>
    How can I get the dynamic id of the check box in the javascript?
    I don't want to do this in the backing bean, as it causes more server trips.
    Thanks & regards,
    Menaka.

    What about using this in your js script?
    onchange="changeCheckboxValue(this)"
    Names generated by JSF implementation have the format:
    <form>:<component>
    For data table is like:
    <form>:<datatable>:<row #>:<component>
    For example:
    form1:dataTable1:1:outputText1
    You could parse the name of "this" and found what row and form the other component name, for example:
    name = "form1:dataTable1:" + row + outputText1;
    this.form[name].text = "hello";
    Regards.

  • I can't change info (options) from Music to AudioBook

    When I record an audiobook it is recorded under music. Once it is recorded I was always able to change the options from Music to Audiobook  by using 'Get Info' options.  I can do this with some CD's but not others.  Also if an Audiobook has 5 CDs I used to be able to change all 5 at one time from Music to Audiobook.  Now this doesn't work at all.  I was running Itunes 10 on Windows 7 but now am running Itunes 11 on Windows 8.  I don't know if it's the itunes verson or the platform.  Anyone out there know how to force this change?
    Thanks,
    Vicki

    Check to see if iMessage is activated. Also, make sure the other party has iMessage activated. Sending an iMessage requires both parties, the sender and the receiver to have an active internet connection. If iMessage is active, the check your Send & Receive and make sure your phone number is checked. After that, you may need to delete the conversation that you have with that contact, however I've not experienced that when I have an individual send problem with a contact. It will usually pick up that they are connected to data again.

  • Change shape height using javascript

    Hi, is it possible to change e.g. the height of a Shape using javascript?

    I believe you can do this.
    Once you have the information (variables) that you want to display in the graph, call a javascript function.
    In this function it will ask the CP file for the variables you set:
         cp.cpEIGetValue("m_VarHandle.yourVariable Name");
    you'll have to write a loop to put all of the variable in an array.
    If you are using an LMS you can store and retreive the info there, if not you will have to write the array in a cookie.
    Build a webpage with just a graph. Have that page read the cookie and build the graph based on those variables. Insert the web page into Captivate using the Web Object.
    Worked for me in a simplified version. I also used this tutorial for the graph which is quite fancy (coding.smashingmagazine.com/2011/09/23/create-an-animated-bar-graph-with-html-css-and-jque ry/), there are other pages to build dynamic graphs though.

  • Href and target tags tutorial/help needed for use with an existing website

    I have a website, (built through iweb), and an intro movie. I have spent a lot of time trying to understand the proper tags and how to use them without much luck. My goal is to have the homepage associated with my domain name load in a browser while at the same time have my intro movie open in a Quicktime Player window, play, and automatically close leaving the webpage visible. If anyone can point me to a tutorial or walk my through the process I would appreciate it.

    Poster movie style. Requires QuickTime Pro:
    Create an image (or a frame from your movie). This becomes the "poster". You could add text to it (Click to Play) in a graphic editor app to help your viewers or add text to the page under the image with these instructions.
    Save this new file as poster.mov
    It becomes the src="poster.mov" (source tag in the html code). Set its dimensions to fit your page layout.
    Your "intro movie" will be your href="intro.mov" (href tag in the html code).
    Open it with QuickTime Pro and then open the Movie Properties window. Click on the Presentation tab to see the choices. Automatically close option will close the QuickTime window. Automatically quit option will quit the running QuickTime Player app. This would be a better option as the browser should come back as the "front" application. You also want to check "auto play".
    Use Save As (preserves fast start feature) and name this file intro.mov
    In your html code for the QuickTime files you need to set target="quicktimeplayer" (this launches the QuickTime Player app instead of using the browser plug-in). It may also help if you use the full URL to both files in each tag (http://myserver.com/foldername/intro.mov).
    One of mine as an example. It uses automatically close window:
    http://homepage.mac.com/kkirkster/mycareerfuture/
    View the source code to see the tag structure. My page uses javascript instead of the older object/embed tag code.
    More useful links:
    http://developer.apple.com/internet/ieembedprep.html
    http://www.qtbridge.com/pageot/pageot.html

  • How To... Change the Data Type for a SELECT-OPTIONS at run time.

    Hello,
    I am trying to restrict the values available for entry into a SELECT-OPTIONS at run time depending on user input.
    The logic is as follows. The user has two input fields. A PARAMETER field which has the type RSDIOBJNM and allows them to choose an InfoObject. And the user has a SELECT-OPTIONS field to allow them to select the Characteristic values for that InfoObject.
    I would like the following example to be possible:
    The user enters 0MATERIAL into the PARAMETER. When the user clicks on the SELECT-OPTIONS control code will derive a list of possible options the user can enter in the SELECT-OPTIONS. In this case only values found in the master data or at least no values greater than 18 characters.
    I have looked at the following function module SELECT_OPTIONS_RESTRICT and this do not appear to be helpful as they only restrict on the signs allowed for the values (unless I misunderstand, it is a complex function module!).
    The code I have so far is (thus the user enters a InfoObject into p_char1 and the select options so_char1 should only accept active values of that InfoObject):
    declaration of variables for user interface
      DATA c_char(32) TYPE c.
    declaration of count variable
      DATA i_count TYPE i.
    declaration of user interface
      SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
        PARAMETERS: p_ipack TYPE RSLOGDPID.
      SELECTION-SCREEN END OF BLOCK a1.
      SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
        PARAMETERS: p_char1 TYPE RSDIOBJNM.
        SELECT-OPTIONS: so_char1  for c_char NO INTERVALS.
        PARAMETERS: p_char2 TYPE RSDIOBJNM.
        SELECT-OPTIONS: so_char2  for c_char NO INTERVALS.
        PARAMETERS: p_char3 TYPE RSDIOBJNM.
        SELECT-OPTIONS: so_char3  for c_char NO INTERVALS.
      SELECTION-SCREEN END OF BLOCK b1.
    Is what I am trying to do possible???
    Thanks for any help. Ross.

    You really want to restrict possible values of a select-option based on another field, not change the length of type of the select-option field, right?
    Here is what you do:  Code a custom F4 value help for the select-option at event AT SELECTION-SCREEN ON VALUE REQUEST FOR..  The first thing you do here is read the value of the parameter field (p_ipack in your example).  You can use function module DYNP_VALUES_READ.  Based on this value, you can propose values for the select-option fields.  Note that the use can still enter whatever s(he) wishes in to the select-option field without pressing F4. In this case, you will have to code some input validations taking into account the value in the p_ipack field.

  • I am using Illustrator CS5. I am using a certain font and when I make a selection to use one of the letter options or a glyph, it does not take my selection; in other words, nothing changes.

    I am using Illustrator CS5. I am using a certain font and when I make a selection to use one of the letter options or a glyph, it does not take my selection; in other words, nothing changes.

    What font? What system? What Glyph? What language settings? Could be anything. Either way, ask in the AI forum. You'll get quicker answers there - if you provide all the required info.
    Mylenium

  • Printing web page with select tags in IE9 and a .cfm file-only the original selected option prints

    My web page has a select tag and cfselect tags and when I print the page with a different option other than the originally selected option the print for both types of select tags reverts back to the original selection and ignores the new selection.  This happens in IE9 and .cfm files but not when the page is printed in IE8 or IE7 modes (tried in the F12 Developer Tools.)  It also needs to be a .cfm file.  FireFox printed the pages correctly for any combination.
    This was done on a Dell and ThinkCentre computers under Windows 7.  Also, I was able to reproduce the same problem on an different university web site where a selection box would revert back to the original selection for printing on a .cfm page and would print properly on a .PHP page at the same site.
    For my site, I used a print button which calls print() and right clicked and chose print and got the same results no matter which method was used.  I only had the right click method on the third party web site.
    I know this is probably a bit narrow an issue but, any help would be appreciated.

    It appears that it is probably an IE9 bug.
    I simplified the problem by turning the page source taken from the brouser of the original .cfm into an html file and found that it would still print improperly.
    When I eliminated the various parts of the file I found that it would print correctly only when I removed the first line, the "DOC type" line.
    The page will print the newly selected option but then I lose the style sheet.
    If it does not work in an HTML file it must be IE.  It is not the .cfm.  The reason that it did not work for .cfm files, is that they always have a "DOC type" statement.
    I have put the issue into an MSDN forum in addition to the one mentioned previously.

  • HTML select tag on irpt page - update database from options

    Hi all,
    I have an irpt page with two selects.  It is the traditional move stuff from one select to the other, then set the order of the options in the configured select.  (Admin page to specify an ordered list of items)
    After the user gets the list how they want it, I would like to send the options to an MII transaction (iCommand?) to update the database table that backs this admin data.
    I can do a comma delimited string to hold the select tag's option values, but would like to know if there is a more elegant way!
    Ideas?
    Thanks,
    --Amy Smith
    --Haworth

    It sounds elegant already - a pretty simple javascript loop to build your csv and Param.1 to your iCommand applet query should work like a charm.
    If you need to run it to a TRX, then the StringListToXML action makes turning your csv into linkable properties a simple effort.

  • Dynamically change table selecting from

    in 3.2 on 11g database is there a way to dynamically change the table used in a select statement for an interactive report? I have a series of similar tables, one for each month of the year. I want to click a month on one page and bring up a report from the table for that month. I want to use one page for this report and have all links from previous page link to the same page, just different result based on what month was clicked.
    I know I could just setup 12 different reports and conditionally display each region based on a value passed to the that page, but I'd prefer to only create one page & one report on that page.
    Thanks for any ideas or solutions.

    Your function will have the code dynamically built.. What you do is you build your sql and pass in the table name and any other items that will change based upon your requirements..
    here is an example...
    function inventory_report (p_State IN VARCHAR2) RETURN VARCHAR2 IS
    declare
      q varchar2(4000);
    begin
      q:='   select p.category, ';
      q:=q||'       p.product_name, ';
      q:=q||'       p.quantity, ';
      q:=q||'       p.unit_price '; 
    -- Here is where we substitute the passed in state name for the data table we extract data from
      q:=q||'  from ' || V('p_State') || ' p, ';
      q:=q||' where p.product_quantity > 0 ';
      return q;
    end;Thank you,
    Tony Miller
    Webster, TX

  • Why does the menu option change to "save as" after I select the print button?

    why does the menu option change to "save as" after I select the print button?

    >>The print command is selected in the File pull down menu, the print menu page pops up, I can then select my networked printer (which incidentally is confirmed to work with other software), the print command is in the bottom right hand corner and finally after depressing this print button a "save as" pop-up menu appears and then it only re-saves the file. Is this an issue with the pdf reader install?  

  • [Awesome] dynamically change tag names?

    Is there a way to change the name of a tag displayed in the tag box widget during run time?, I dont really want dynamic tagging, but it is a solution if none other exist.

    There's two patches for awesome that provide dynamic tagging; Eminent and Shifty.
    See on the Archlinux wiki page for awesome: https://wiki.archlinux.org/index.php/Aw … ic_tagging
    EDIT: Ah, I see that you'd like to rename existing tags... don't know if there's a way to do that, but it could be a feature of either Eminent or Shifty.
    EDIT2:  Aaaaand, it looks like Shifty offers a tag creation/rename prompt in the task list, so that should do what you want
    Last edited by snk (2011-09-05 18:09:57)

  • Need to fill up Data into  the select Tag options value

    Hi ,
    This is my requirement . I am having two select tags inside my jsp page . one for country and one for state .Upon selecting a country the select tag for states should be filled up .
    Right now i need to fill up the data under country select Tag .I am using AJAX for this .On body onload i am calling a function to get Country data .
    //This is inside my servlet
    *               ResultSet res = st.executeQuery("SELECT * FROM countries );*
    *               StringBuffer sb = new StringBuffer();*
    *     sb.append("<countries>");*
    *               while (res.next())*
    *               String result = res.getString(1);*
    *               sb.append("<country>"+result+"</country>");*
    *               sb.append("</countries>");*
    *               response.getWriter().write(sb.toString());*
    This is Inside MY JSP
    if( xmlHttp.readyState==4 )
    if( xmlHttp.status==200 )
    xmlDoc=xmlHttp.responseXML;
    xmlDoc.getElementsByTagName("countries")
    <select name='countrsel' id="countrsel" onchange="call()">
    <option value="<%=%>"><%=%></option>
    </select>
    I am struck up here please help
    Edited by: RaviKIran on Nov 2, 2009 9:51 AM

    Hi ,
    This is my requirement . I am having two select tags inside my jsp page . one for country and one for state .Upon selecting a country the select tag for states should be filled up .
    Right now i need to fill up the data under country select Tag .I am using AJAX for this .On body onload i am calling a function to get Country data .
    //This is inside my servlet
    *               ResultSet res = st.executeQuery("SELECT * FROM countries );*
    *               StringBuffer sb = new StringBuffer();*
    *     sb.append("<countries>");*
    *               while (res.next())*
    *               String result = res.getString(1);*
    *               sb.append("<country>"+result+"</country>");*
    *               sb.append("</countries>");*
    *               response.getWriter().write(sb.toString());*
    This is Inside MY JSP
    if( xmlHttp.readyState==4 )
    if( xmlHttp.status==200 )
    xmlDoc=xmlHttp.responseXML;
    xmlDoc.getElementsByTagName("countries")
    <select name='countrsel' id="countrsel" onchange="call()">
    <option value="<%=%>"><%=%></option>
    </select>
    I am struck up here please help
    Edited by: RaviKIran on Nov 2, 2009 9:51 AM

Maybe you are looking for

  • Custom BI Report in Launchpad

    Hi , We have a BI Report(Bex Web Application Query String) -SAP BW2.x/3.x format. How can we provide the link in the standard role of SRM7.0 business package? I created the view to test it in the portal it is executed without any problem in the previ

  • How to setup web.xml files in Tomcat 4.0.6

    Hi, I'm to new to Java Servlets. i am trying to run my first servlet but it's not showing up..can anyone help me out please!!! I created a folders like this: webapps/sumitapps/WEB-INF\classes\Forms\login.class under sumitapps: i'm puttin all of my .h

  • IExpenses Setup: Page not found

    Hi friends, Apps R12 Entering on iExpenses Superuser --> iExpenses Setup screen: Policy Tab.Schedules Inside Accomodation (i.e.) choosing one of them you have saved... then click on Update General icon. It appears a 1st screen of three steps. (Genera

  • IPhone SDK 3.1.3??!?!?

    I have been trying to download the iPhone SDK 3.1.3 for hours, but I can't seem to find where to download it. I've read on the Apple site that it was free to download. I have found it before, tried to download it, and said I needed to log in. I was a

  • Error message saying registrysetting missing for itunes drivers

    i have been gettting the same message every time i open itunes.i have uninstalled and reinstalled itunes many times but am getting same message over and over again.it is as follows The registry settings used by the itunes drivers for importing and bu