Combo box in javascript

I have a combo box (combo1), and on changing the value selected in it, a second combo box (combo 2) is displayed on the screen.
I need to be able to add some java script code for Combo2, as depending on the value selected in it, some further action has to be done.
All the code i've tried searching for so far, uses the HTML version of combo box, and accesses the value in java script using the line "document.formname.OPTION.[selectedindex].value".
How would i do the same for a JSF combo box, in java script?
Thanks in advance :)

hi.. thanks for the response.. i did as u suggested but i got the following error : "document.all.menu8 is null or not an object "
The code for my combo box is as follows:
<h:selectOneMenu styleClass="selectOneMenu" id="menu8" onchange="display()">
<f:selectItem itemLabel="select" itemValue="select" />
<f:selectItem itemLabel="option 2" itemValue="op2" />
<f:selectItem itemLabel="option 3" itemValue="itemValue3" /></h:selectOneMenu>
<div id="op2" style="DISPLAY: none">The following is the java script snippet:
<script language="javascript">
     function display()
          document.all.op2.style.display='none';
          document.all.itemValue3.style.display='none';
          var d=document.all.menu8.getElementById(menu8);
          var name=d.options[d.selectedIndex].value;
          if(name!='select')
           eval("document.all."+name+".style.display='' ");
          </script>Is it that the 'div' tag is incompatible in this case?

Similar Messages

  • Combo box in JavaScript and store the combo box values into database

    i am a developer, i have a task ie.. i have combo box in JavaScript and i have to store the combo box values into database through JavaServerPage..
    i please every one to have a look on this and please reply soon....

    dear sir,
    your suggestions are really greater the god.............
    i have applied as you said , now i am the page as updated and also i nform you that its multi select ....
    i will show the codings , then u will get a clear identification
    <script language= "JavaScript">
    <!--
    function one2two() {
        m1len = m1.length ;
        for ( i=0; i<m1len ; i++){
            if (m1.options.selected == true ) {
    m2len = m2.length;
    m2.options[m2len]= new Option(m1.options[i].text);
    for ( i = (m1len -1); i>=0; i--){
    if (m1.options[i].selected == true ) {
    m1.options[i] = null;
    function two2one() {
    m2len = m2.length ;
    for ( i=0; i<m2len ; i++){
    if (m2.options[i].selected == true ) {
    m1len = m1.length;
    m1.options[m1len]= new Option(m2.options[i].text);
    for ( i=(m2len-1); i>=0; i--) {
    if (m2.options[i].selected == true ) {
    m2.options[i] = null;
    //-->
    </script>
    <form method="POST" name="theForm" action="update.jsp">
    <table bgcolor="white" border="1" cellpadding="5" cellspacing="2" align="center">
    <tr><td align="center">
    <select id=menu1 size=10 multiple>
    <option>javascript</option>
    <option>php</option>
    <option>Zeo</option>
    <option>asp</option>
    <option>jsp</option>
    <option>ajax</option>
    <option>struts</option>
    </select>
    <p align="center"><input type="button" onClick="one2two()" value=" >> "></p>
    </td><td align="center">
    Languages you know:<BR>
    <SELECT NAME="language" multiple>
    <OPTION VALUE="c">C
    <OPTION VALUE="c++">C++
    </SELECT>
    <p align="center"><input type="button" onClick="two2one()" value=" << " ></p>
    </td></tr></table>
    <center><input type="submit" value="update"></center>
    </form>
    <h4><u>Back<h4>
    <script language= "JavaScript">
    var m1 = document.theForm.menu1;
    var m2 = document.theForm.language;
    </script>
    </body>
    </html>

  • How yo fill combo box by javascript

    hi all,
    i am new to acrobat. working on Acrobat 9.
    i m tryin to add elements to a combo box by javascript....i tried using "setItem()" bt this didnt help

    finally i was able to populate the combo with numbers in a loop....actually wht i m tryin is to populate the combo with name of meshes in a 3D model using 3D tool added on the pdf, on the click of button....bt i cldnt establish connection between the 3d object and the form elements on the pdf

  • How validate a combo box generated for a selectOne on javascript

    Hi!!
    I have a question!
    i need how validate a combo box on javascript if this is generated by selectOne
    for example:
    <tr>
    <td width="150px"><b>Cantidad a elegir:</b></td>
    <td><f:selectOne att='idisponibilidad.cantidadElegir' type='combo'/></td>
    </tr>
    this is an form and this generates in the name of the select:
    <select name="$FO$idisponibilidad.cantidadElegir">
    <option value="0">..</option>
    <option value="4">..</option>
    </select>
    but now I try to do this:
    document.form.$FO$idisponibilidad.cantidadElegir.value
    and obviously does not work!!!
    someone knows how to validate
    Thanks!!!

    Taking Mark's Code .. add an id
    <select id="personGender" <f:fieldName att="person.gender"/>>
    <c:forEach var="gender" begin="0" items="${genders}" varStatus="status">
    <c:choose>
    <c:when test="${person.gender == gender}">
    <option value="<c:out value="${gender}"/>" selected="true"><c:out value="${gender}"/></option>
    </c:when>
    <c:otherwise>
    <option value="<c:out value="${gender}"/>"><c:out value="${gender}"/></option>
    </c:otherwise>
    </c:choose>
    </c:forEach>
    </select>
    Add an id to above code. In your submit button write a function on onclick event .. like onclick="submitForm()"
    Write the functions as :
    function submitForm(){
         if(validateFileds()){
    document.<your form id>.submit();
    function validateFields(){
    if (isEmptyCombo ('personGender')) {
                   alert ( "'Selecting a gender is mandatory" );
                   focus('personGender');
                   return false;
    function isEmptyCombo (id) {
         var combo = document.getElementById(id);
         return combo != null && combo.options[combo.selectedIndex].value == "";
    function focus (id) {
         if (document.getElementById(id)) document.getElementById(id).focus();
    Thanks,
    Karmaresh
    Edited by: user856811 on Mar 15, 2010 9:22 PM
    Edited by: user856811 on Mar 15, 2010 9:22 PM

  • Adobe Acrobat 9: Javascript array populated combo box - Selected answer will not save

    I have a combo box on one of my forms that is populated using a Javascript array.  The combo box is populating just fine, but when an item is selected from that combo box, the selected item does not save when the user saves the document.  Any suggestions as to what the problem is and how it can be corrected?  I am a loss as to where to even begin looking.  Any help is greatly appreciated.
    Thank you.
    Lisa

    You might also want to check the Scripting forum
    http://forums.adobe.com/community/acrobat/acrobat_scripting

  • Newb deserving assistance with Adobe Javascript (check boxes and combo boxes)

    Hi, I'm a newb when it comes to javascript (using adobe acrobat pro 6.0).
    I am working on a form that will allow me to autofill checkboxes based off of information chosen. Ideally, I would like to have a selection from a combo box autofill/auto checkmark check boxes. Alternatively, I would be willing to just have different selections presented with check boxes that when filled, would auto checkmark other check boxes (I know how to do this one, but I am not sure how to clear the check boxes if the initial one is unchecked).
    I have the action button tied to the mouse up function. This just errors out.
    var Citrix = this.getField("Citrix")
    var Appro = this.getField("Appro")
    var SAS = this.getField("SAS")
    if (event.target.value=="Yes") {
    Citrix.checkThisBox = true
    Appro.checkThisBox = true
    SAS.checkThisBox = true
    else {
    Citrix.checkThisBox = false
    Appro.checkThisBox = false
    SAS.checkThisBox = false
    I have this that works, but I don't know how to clear the buttons when "Associate" is unchecked.
    if(this.getField("Associate").isBoxChecked(0));
    this.getField("Citrix").checkThisBox(0, true);
    this.getField("Appro").checkThisBox(0, true);
    this.getField("SAS").checkThisBox(0, true);
    The other way I was working on it, was to use a combo box to autofill/checkmark check boxes. But this code doesn't work either.
    function calculateTextField()
    // get the value of the combo box
    var comboValue = this.getField("Select").value;
    // get the state of the checkbox
    var isChecked = (this.getField("Citrix").value == "Yes");
    var textFieldValue = "";
    console.println(comboValue);
    if (isChecked)
    if (comboValue == 0)
    textFieldValue = "";
    if (comboValue == "Associate")
    (this.getField("Citrix").value == "Yes");
    else if (comboValue == "Specialist")
    (this.getField("Citrix").value == "Yes");
    else if (comboValue == "Team Leader")
    (this.getField("Citrix").value == "No");
    else
    (this.getField("Citrix").value == "No");
    else
    textFieldValue = "";
    this.getField("Select").value = textFieldValue;
    Can anyone please assist me with this?
    Thanks,
    Chris

    Hi Gene,
    Thank you for the response. Are you saying that my initial formula should look more like this; ?
    var Citrix = this.getField("Citrix")
    var Appro = this.getField("Appro")
    var SAS = this.getField("SAS")
    if (event.target.value=="Yes") {
    Citrix.checkThisBox = true
    Appro.checkThisBox = true
    SAS.checkThisBox = true
    else {
    if (event.target.value=="Off")
    Citrix.checkThisBox = true
    Appro.checkThisBox = true
    SAS.checkThisBox = true
    Thanks,
    Chris

  • Show text box from one combo box selection

    Total newb here and need help.  I tried searching for a javascript to copy/paste, but without any luck.  I am using Acrobat Pro 9.2.0.  If you could help me out with the javascript or with directions on how to make the following be accomplished, I would be greatly appreciative.
    I am creating a fillable PDF and currently have a combo box that is labeled "Internship Satisfied By" with the options of "TCoB PDP", "MRKTNG 4185", and "Other College".  I would like a hidden text box (where the end user can fill in to explain) to become visible only when the end user selects the "Other College" option, but stay hidden for the other selections.  The hidden text box is labeled "Internship Explained".
    Thanks in advance! Jarrod

    Use this code as the combo box's validation script:
    if (event.value == "Other College") {
    getField("Internship Explained").display = display.visible;
    } else {
    getField("Internship Explained").display = display.hidden;

  • How can we pass selected combo box value to a jsp pag?

    Hi All,
    I want to pass selected combo box value to a same jsp page's variable.
    i am using javascript
    <select onchange="this.options[this.selectedIndex].text">
    </select>
    this selected value should be invoked for a jsp page's variable.
    Excepting for favorable reply
    Vansh

    select2.jsp
    <script>
    function x()
         alert(document.f.s.options[document.f.s.selectedIndex].text);
         document.f.submit();
    </script>
    <body>
    <form method="get" name="f" action="select2.jsp">
    <select name="s" onchange="x()">
    <option checked>--select--</option>
    <option value="1"> vijay </option>
    <option value="2"> kumar </option>
    </select>
    </form>
    </body>

  • COMBO BOXES AND SOME PAGES ARE NOT SHOWN CORRECTLY IN SOME WEBSITES LIKE SBICAPSEC AND MAXNEWYORK LIFE. BUT NO PROBLEM USING WITH IEXPLORER

    I am not able to login to maxnewyork life insurance site while using firefox. I am using firefox 3.6.10 now. Combo boxes are not shown in the some trading websites. I uses noscript2.0.3.3, javaconsol6.0.21, javascript option 1.2.6 and WOT20100908. It creates feeling of inferiority in using Firefox due to these problems.

    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites that cause problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Can I attach a specific action to a choice in a list box or combo box?

    I have a list of 26 sports that I would like people to choose from--in either a list box or combo box or any other tool that would work best. When they choose a particular sport, I would like another PDF to appear with the roster for that sport for this year, allowing them to check off certain players.  Is this possible? Everything I see is in javascript or some other language that I don't know.
    Thanks.
    Anne

    I am piling on Gary's question, as I would like to know the answer as well. But first a little more color in case there is another way to do this....
    When I get an email, I usually take some sort of action. I currently do not have a good way to note the actions I have taken against any particular email. This is why I want to know how to attach a note or a To Do to a particular email. I thought the To Do list would work, but when I type a To Do with a particular email sometimes it appears in the list and sometimes it doesn't.
    So my goal is to have a way to create a history of action against a particular email.
    Gary, I hope this is a valuable extension to your request as opposed to a diversion from your original intent. With any luck together we'll get a bit more traction for your request.
    Thanks.

  • Is it possible to have a combo box change an image on a form?  How do you do it?

    I would like to have an area in one of my PDF forms where a combo box with 8 items changes an image near the combo box.  8 items 8 images.  if you select item 3 in the list then image 3 is displayed in the image area or field. 
    Is this possible?  Might someone guide me as to what steps are necessary.  I can make this happen with web, asp, c++ etc.  I just don't know how to do it in adobe if it's possible.
    example below.
    Any help or guidence is appreciated.

    Here's a sample that demonstrates what you want: https://acrobat.com/#d=It35dD4zaX5QM--Pv36F-Q
    The buttons on the right hand side would normally be hidden and you can use anything you want for their icon, even though in this case it's just text. You'll have to study the JavaScript to see how it works. There are two functions in a document-level JavaScript, one of which is called from the combo box's Keystroke event. Also, note the export values of the items in the list and how the script uses them.

  • How to get  Subvalues using Combo box ?

    Hi , friends,
    I have one Combo box :
    Having list of all Districts
    When i select one of District it will give all related villages
    regarding District that i selected in another combo box.
    How to achieve this ? in one page itself
    I have another idea but its not good..
    where
    1) first select District from Combo
    2) Press submit
    3) second page displays another combo and fetch perticular villages
    and display in another combo.
    but this technique requires more page navigation.
    I want it should be on one page itself
    PLEASE HELP ME ....
    Ghanshyam
    Message was edited by:
    Ghanshyam

    the brand old dependent combo issue..
    as far as i know i could tell you for every two days a similar post is being posted here on the same thread..
    you could have taken a look of them....
    Anyways there are many ways of doing it....
    In the days when XmlHttpRequest Object was not invented ppl used to achieve this using Hidden iframe and then updating parent frame dropdown by calling a javascript function onload of the page. or by auto refershing the page after saving the form state inside the scope of session.
    However,using XmlHttpRequest Object (AJAX) nowdays is one of the smater ways of acheving tasks as these.
    checkout one such examples where i've posted a similar example in the last reply
    http://forum.java.sun.com/thread.jspa?threadID=5170019
    hope this might help :)
    REGARDS,
    RaHuL

  • While selecting value from combo box in one frame, based on the selection..

    Hi friends,
    can someone help me out on a issue as it follows:-
    iam developing an application where Iam using xsl,html,javascript and xml.
    There is no existense of Database at all. data is read from xml.
    now,
    In a window there are 3 frames. In the 1st frame combo box is there.
    Based on the selection in the combo box data will be displayed in the 2nd frame.
    now onchange or onselect methods not giving the expected result.
    actually,in the the xsl which is having 3 frames,the 1st and 3rd frame
    calling src="abc.xml" and src="abc.xml"which are static.
    but in the 2nd frame the data need to be changed dynamically.
    I have given frame name="frame_ExchangeDetails2" rows="3%" src="cc_marketWatch_02.xml"/>
    usually data dynamically comes from database.but here i have to refer xml file
    something like [window.href.location="abc.xml"]
    but the problem is when you refer supose:-
    <frame name="frame_ExchangeDetails2" rows="3%" src="cc_marketWatch_02.xml"/>
    the frame is having static page,though there are functions in javascript which are called in onload and onchange.which are not working.
    I have tried putting if condition like:-
    if(document.abc.fieldname.value=='6'
    {   window.location.href = "cc_custLookUpData-mobileno.xml";   
    so that it could go to the repective page.
    but it is not working.
    so what should i do if I select from combo box in one frame and based on the selection xml/html page will be displayed in the 2nd frame.
    if anybody has google account i can forward the zip file so it will be easier to understand.
    Regards
    Message was edited by:
    Postqueries
    Message was edited by:
    Postqueries

    If you have rights to modify tabular model then, you can create a measure in your Tabular model which returns previous week and then use this measure in Pivot Table.
    Thanks,
    Sagar K 
    (Blog: http://datamazik.blogspot.in/)

  • How to Add/Concatenate to a text field, values selected in a combo box

    I have a combo box form field that allows the user to select a value from a list and click on an Add button. The Add button should add/concatenate the vaue selected to a text field in order to create a list of values selected. I'm not sure how to do this using Javascript in Acrobat? I know I need to add the javascript to the Add button's Mouse Up action. Any help would be greatly appreciated. Thanks!

    Thanks so much - it works!
    >>> "Gilad D (try67)" <[email protected]> 9/25/2013 9:16 AM >>>
    Re: How to Add/Concatenate to a text field, values selected in a combo box created by Gilad D (try67) ( http://forums.adobe.com/people/try67 ) in JavaScript - View the full discussion ( http://forums.adobe.com/message/5712118#5712118 )
    Let's say the text field's name is "Text1", and the combo is called "Combo1". You can then use this code as the MouseUp script of the Add button:
    var f1 = this.getField("Text1");
    var f2 = this.getField("Combo1");
    if (f1.value=="") f1.value = f2.value;
    else f1.value = f1.value + ", " + f2.value;
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5712118#5712118
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5712118#5712118
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5712118#5712118. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in JavaScript by email ( mailto:[email protected].com ) or at Adobe Community ( http://forums.adobe.com/choose-container!input.jspa?contentType=1&containerType=14&contain er=3286 )
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Combo Box in JSP

    Hi,
    I am a student and working on a class project. In my application at some point, I need to provide a combo box where user can select multiple values and those values should automatically be printed in a text area provided below the combo box. Is this possible?

    The Only Way By which U can achieve this is by a scripting languages like javascript,vbscript......
    Nvr By JSP(Is nothing but a servlet under execution @ background of webserver) as it is meant for Server Side Programming Surely not for Client Side Dynamic Action.
    Make use of <select> with multiple property set to true....
    and then.... append selected values in the second textbox.
    You may go throgh the code given below
    c whether that can help u out.....
    CLIENT.JSP
    =========
    <%@ page language="JAVA">
    <html>
    <head>
    <script>
    function change(){
    var x=document.getElementById("mySelect")
    document.getElementById("result").value = ""
    for(var i=0;i < x.length;i++){
    if(x.options.selected == true)
    document.getElementById("result").value = document.getElementById("result").value + " "+x.options[i].value
    </script>
    </head>
    <body>
    <select id="mySelect" size="4" multiple onchange="change()">
    <option value='Apple'>Apple</option>
    <option value='Pear'>Pear</option>
    <option value='Banana'>Banana</option>
    <option value='Orange'>Orange</option>
    </select>
    <input type='text' value='' size='10' name='result' id="result">
    </body>
    </html>
    REGARDS,
    RaHuL

Maybe you are looking for

  • My recent Bridge CC update did not update ACR, how do I do this

    I recently updated Ps CC to the 2014 version. My computer did not at that time update Bridge. I sought Support help to update that. But in both cases I found that one computer running same OS had a newer version of ACR (8.5.0.236), and the one that I

  • How to merge indesign files into one

    Hi, I have some publication as book indesign files, then I want merge these individual indesign files inside one file. I search a lot for plug-ins and scripts to do it, but nothing I dont want just PDF files, because I need edit the files after putti

  • I paid for 6 months and cannot connect. i can hear...

    I need to cancel my account. I paid for 6 months and have not been able to correspnd. I am able to hear the other party but they are unable to hear me. please cancel my account immediately.

  • Out of Perm space

    I'm getting out of perm space in an uncertain condition. The problem can be reproduce with all those settings: Tomcat 4.1.27 , J2SDK 1.4.1_02 , SunOS 5.8 sparc. Tomcat 4.1.27 , J2SDK 1.4.2_01 , Windows 2000 pro. Tomcat 5.0.16 , J2SDK 1.4.2_01 , Windo

  • Insert into tables in different schemas

    hi, I insert into few tables through stored procedures, now there is a scenario wherein, by passing parameters to the stored procedures i should be able to insert into table in another schema. Eg., Table EMP in Schema Dev Table EMP in Schema Test MY