Extracting values from drop down buttons html forms

Hello,
I would like to know how to obtain the values which is selected through the drop down box. Iam using Java Script as a client side scripting lang..
Here is my code so far..do let me know what to do further. Iam not getting the alert mesg which is sitting in the put() so let me know how the put method should work
Thanks a lot
avis
<HTML>
<HEAD>
<script language="javascript" type="text/javascript">
<!-- hide
function put()
choice = document.forms.Pri.list.optionsdocument.forms.Pri.list.selectedIndex]
if (choice ="0")
alert("enter state"+choice);
function goto()
Pri.list.options.value=" "
//end -->
</script>
</HEAD>
<BODY>
<form name="Pri" method = "get" action="">
State<SELECT NAME="list" onChange="put()">
          <OPTION>
<OPTION>Alabama
<OPTION>California
          </SELECT>
<input type="submit" Value="Submit">
<input type=button name="Reset" value=Reset onClick=goto()>
</form>
</BODY>
</HTML>

I'm not sure what you're talking about... if you don't select an option from the list, the onchange function isn't going to be called, so of course the the alert isn't working.
You sound like you are complaining that when the form submits, the value for the select list is the first option (""). I fail to see why this is a problem. If the value is "", then you handle it like nothing was selected. In a single select list like that, an option is always selected. The whole point of having a blank option is to allow the user to pick it. Otherwise don't put a blank option.
In general, you don't need to use a button to do reset, you use a reset button: input type="reset". And it'll reset on it's own.

Similar Messages

  • How to capture selected value from drop down by index

    Dear friends,
    i want to capture the value of select value from drop down by index, for eg if  select air france, how to capture , could any one please let me know
    Thanks
    Vijaya

    Hi Vijaya,
    You can get the value of selected from drop down as below
    Check out the event handler method attached to Onselect event of the ui element drop down by index , if no event is associated, then create an event and attach to the drop down list
    Now you will be having the CONTEXT_ELEMENT in the WDEVENT parameter
                   data lo_element type ref to if_wd_context_element.
                   lo_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT').
    Now, you can get the static attribute value of selected  drop down value & let us say your drop down list values are populated from context node 'ND_DRP_DOWN'
                   data ls_data type wd_this->element_nd_drp_down.
                             lo_element->get_static_attributes(
                                       importing
                                       static_attributes = ls_data ).
    Hope this helps you.
    Regards,
    Rama

  • 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 Change a Default Value from Drop Down Box displayed in Web Dynpro?

    Hi,
    How to Change a Default Value from 'High' to 'Low'  in a Drop Down Box for RANGE field displayed in Standard Web Dynpro Component.  I saw a Default Value set for a RANGE field  in View Context When I select that field and click on Display. I am seeing Default Value set it to 'HI'. Please let me know how to change from HIgh to Low.
    I appreciate your help!
    Thanks,
    Monica

    hi,
    use the set_attribute( ) method now to set the attribute with a particular key eg HIGH in ur case
    // u can use the code wizard( control +f7) this code will be auto generated when u select the
    //radio button to read the context node
    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
      DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
      DATA ls_cn_node TYPE wd_this->element_cn_node.
    * navigate from <CONTEXT> to <CN_NODE> via lead selection
      lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).
    * get element via lead selection
      lo_el_cn_node = lo_nd_cn_node->get_element(  ).
    * set single attribute
      lo_el_cn_node->set_attribute(
          name =  `ATTribute name.`
          value = 'LOW' ).
    it will solve ur query ..
    also refer to this component
    wdr_test_events -> view dropdownbyidx and dropdownbykey ->method name onactionselect.
    regards,
    amit

  • Using getElementById() to get values from drop down list

    Hi, I am using Netbeans to write this program. I have this .java page that gets the url of the HtmlPage from the .properties page. And when this page is opened in the browser, there are drop down lists that have values I want to get from the user when he/she has selected, and save it to a database. I'm actually using mozilla firefox to open this page, and using firebug to inspect the drop down list element.
    I know getElementById is a javascript code, however, my friend told me to use it in the .java page. This is how part of my code looks like. What I'm not sure is how to implement getElementById() and where.
    HtmlPage pageMain =EBPage;
    WebRequest postRequestSettings = new WebRequest(
    new URL(getProperties("trustAdmin")), HttpMethod.POST);
    *// Set the request parameters*
    postRequestSettings.setRequestParameters(new ArrayList());
    postRequestSettings.getRequestParameters().add(new NameValuePair("component", "edit"));
    postRequestSettings.getRequestParameters().add(new NameValuePair("formids", "unixTime,instance,time,description,message"));
    postRequestSettings.getRequestParameters().add(new NameValuePair("page", "Status"));
    postRequestSettings.getRequestParameters().add(new NameValuePair("service", "direct"));
    postRequestSettings.getRequestParameters().add(new NameValuePair("session", "T"));
    postRequestSettings.getRequestParameters().add(new NameValuePair("submitmode", "submit"));
    postRequestSettings.getRequestParameters().add(new NameValuePair("submitname", ""));
    *// Insert instance of message here*
    postRequestSettings.getRequestParameters().add(new NameValuePair("instance", instance));
    *// Insert content of message here*
    postRequestSettings.getRequestParameters().add(new NameValuePair("message", message));
    *// Insert description of message here*
    postRequestSettings.getRequestParameters().add(new NameValuePair("description", description));
    *// Insert time of message here*
    postRequestSettings.getRequestParameters().add(new NameValuePair("time", time));
    *// Convert time to unix seconds*
    postRequestSettings.getRequestParameters().add(new NameValuePair("unixTime", String.valueOf(System.currentTimeMillis() / 1000)));
    HtmlPage newPage1 = pageMain.getWebClient().getPage(postRequestSettings);
    WebRequest requestSettings = new WebRequest(
    new URL("http://www.google.com"), HttpMethod.GET);
    requestSettings.setRequestParameters(new ArrayList());
    requestSettings.getRequestParameters().add(new NameValuePair("page", "Preview"));
    requestSettings.getRequestParameters().add(new NameValuePair("service", "page"));
    newPage1 = newPage1.getWebClient().getPage(requestSettings);
    And I'm told to insert page.getElementById() in the place shown below:
    HtmlPage page = null;
    page.getElementById()_
    *try {*
    *// Login proxy*
    page = (HtmlPage) jsonBrowser.getPage(getProperties("jsonBrowser"));
    String proxyUrl = page.getForms().get(0).getAttribute("action");
    System.out.println("Proxy Url" + proxyUrl);
    WebRequest requestSettings = new WebRequest(
    new URL(proxyUrl), HttpMethod.POST);
    requestSettings.setRequestParameters(new ArrayList());
    requestSettings.getRequestParameters().add(new NameValuePair("PROXY_SG_PASSWORD", password));
    requestSettings.getRequestParameters().add(new NameValuePair("PROXY_SG_PRIVATE_CHALLENGE_STATE", ""));
    requestSettings.getRequestParameters().add(new NameValuePair("PROXY_SG_REQUEST_ID", ""));
    requestSettings.getRequestParameters().add(new NameValuePair("PROXY_SG_USERNAME", userID));
    *// Get the page*
    page = page.getWebClient().getPage(requestSettings);
    Logger.getLogger(postTrustMessage.class.getName()).log(Level.INFO, "===================================Login in Trust");
    Logger.getLogger(postTrustMessage.class.getName()).log(Level.INFO, page.getWebResponse().getContentAsString());
    *} catch (IOException ex) {*
    Logger.getLogger(postTrustMessage.class.getName()).log(Level.SEVERE, null, ex);
    *} catch (FailingHttpStatusCodeException ex) {*
    Logger.getLogger(postTrustMessage.class.getName()).log(Level.SEVERE, null, ex);
    return page;
    Any help would be greatly appreciated. Thanks.

    I want to value drop down list from seeded page of EBSString picklistvalue = pageContext.getParameter("PickListBeanID"); //PickListBeanID is the ID of the MessageChoiceBean
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • How to insert date picker from drop down calendar in forms

    I want to insert a calendar to select the date from in the 'Date of Training' column in my forms instead of manually typing in the date each time - how do I do this please?

    There's no built-in calendar component in Acrobat forms. There are some third-party ones, though. The main ones are a free one that uses fields by FormRouter and a paid tool which uses a dialog object, developed by Max Wyss.

  • How to get the values of drop downs, which are gonna create at run time.

    As per my design requirement, I have to create drop downs in an ADF display table.
    The no# of rows of the table are gonna decide the no# of the drop downs. User can select the values from drop downs. My issue is, how can I capture the selected values of those drop downs as those are gonna created run time.

    Hi
    ohh ,ok ,then as u said that u r storing twenty values ,thats y i aksed earlier ,are these form values part of tbale ,or as u said 20 values are there ,for these u r creating 20 form values ???.
    My suggestion would be ,u do four calculation and put all your results in a hashmap ,and keep this hash map in to sesion ,using the following method
    pageContext.putTransactionTransientValue("HashMapName",myHashMap);
    and inside the PFR method when u want to display these values ,u can loop through your hashmap and can display these values.
    like this
    HasMap hm=pageContext.getTransactionTransientValue("HashMapName");
    thanx
    Pratap

  • Populating values to drop down list in Adobe Forms

    Hi,
    We have added a drop down list in our adobe form. Our requirement is Payment Terms should be displayed in this drop down list. We tried by adding values to drop down list in object palette window by using '+' sign. But now we want to display values dynamically from table T052U. We need to bring two fields ZTERM and TEXT1. We don't want to use database connection, just from a table as an importing parameter it should be appended to this list.
    Atpresent, we don't want to use webdynpro or java for getting values.
    Please provide suitable answers.

    hi,
    cretae simple type in data dictionary i don't have any idea to create simple type in adobe forms.
    For creating Simple Type------in Dictionary->Local Dictionary->Data Type->Simple Type(here right click u get  create simple type).and after that choose Enumaration Here u can add values
    and create a node WITH one attribute and this attribute is off Type of that simple type u created in local dictionary and bind that node with interactive form data source property ,now in interactive form drag and drop that attribte from your dataView Run your application  these values will populate in your Interactive form.
    Regards
    Trilochan

  • How to add values to drop down list in adobe forms

    how to add values to drop down list in adobe forms

    Hi,
    If you are using WD Java following are steps of filling values in DD Box:
    1 Create a simple type in the Dictionary.
    2 Create an attribute "CountryNew" in the Context of type created by you.
    3 Write following code in the init method of the form:
    IWDAttributeInfo countryinfo =
                   wdContext.nodeEmployee().getNodeInfo().getAttribute("CountryNew");
    ISimpleTypeModifiable Country = countryinfo.getModifiableSimpleType();
    IModifiableSimpleValueSet countryValueSet =
                   Country.getSVServices().getModifiableSimpleValueSet();
    countryValueSet.put("IN", "INDIA");
    countryValueSet.put("US "USA");
    4 Add a Enumrated DD box in the form and bind it to the attribute "CountryNew"
    Hope this helps
    Amit

  • Drop down buttons from a JToolBar

    I've been looking at various postings on how to get drop down options from a JToolBar. What I have seen suggests using JPopupMenu.
    However for my requirements I simply want the drop down buttons to appear in a gridlayout rather than as a drop down menu. Just the icons with no labels.
    Is it possible to change the layout manager up JPopupMenu or should I be trying some other component?
    The code I am trying looks something like that below where I demonstrate a toolbar dropdown color picker. The change of the layout manager seems to have no effect.
    final JButton standardColorButton = _toolBar.add(_actionStandardColor);
    final JButton changeColorButton = new JButton(_actionChangeStandardColor);
    _toolBar.add(changeColorButton);
    changeColorButton.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            int height = standardColorButton.getPreferredSize().height;
            JPopupMenu popup = new JPopupMenu("test");
            popup.add(_actionRed);
            popup.add(_actionGreen);
            popup.add(_actionBlue);
            popup.add(_actionBlack);
            popup.show(associationButton, 0, height);
            popup.setLayout(new GridLayout(0,2));

    Hi Vijay,
    Is this correct?
       var oInput = new sap.ui.commons.DropdownBox("ddlb_matnr");
           var oItemTemplate = new sap.ui.core.ListItem();
           oItemTemplate.bindProperty("key", "Matnr");
           oItemTemplate.bindProperty("text", "Description);     
           oInput.bindItems("/sap/opu/odata/sap/Z_MATNR_F4_SRV/materialSet", oItemTemplate, null, "'');
    This should work ?
    I tried this.. it is not fetching...         
    Let me know?

  • Please help: Populating values in drop down list by onchange - javascript !

    I am working on a task - I need to populate drop down named "year" dynamically (from database) depending upon the select of an element from drop down list "carLine" . I am calling javascript funtion on onchange event of the html select and setting property of the selected element.The environment is Struts and dynaactionform is being used . Here is the my html select for both the drop down list s and javascript funtion to set value. The getYears method is defined in the locatoraction action class. But after doing all these carLine is not getting populated with the values corresponding to selected carline.
    Database side is working fine .
    <script type="text/javascript">
    function getYearsForCarline(){
    document.getElementById('method').value = 'getYears';
    document.forms[0].submit();
    alert("submitted");
    </script>
    <html:form styleId="locatorForm" action="/locator/locatorAction" method="post">
              <input type="hidden" name="method" value="getYears" />
              <tr>
                   <td align="center">
                   <table border="0" width="300" cellpadding="0" cellspacing="5">
                        <tr>
                             <td><span class="formLabelEM"><bean:message
                                  key="label.locator.carLine" />*</span>
                             <html:select styleId="carLineBox" property="carLine" onchange="javascript:getYearsForCarline()">
                                  <html:option value="">Select a Carline</html:option>
                                  <html:optionsCollection property="carLines" />
                             </html:select></td>
                        </tr>
                        <tr>
                             <td><span class="formLabelEM"><bean:message
                                  key="label.locator.modelYear" />*</span>
                             <html:select property="year" >
                             <html:option value="">Select Year</html:option>
                                  <html:optionsCollection property="years" />
    Any advise will be highly appreciated . Thanks in advance.

    Thanks both of you for the advise ! My code worked perfectly fine after adding separate action mapping for Year and using that as action in the form though the new action mapping point to the same action class locatorAction ..I still do not understand the reason behind this exactly(any suggestion are most welcome) but it works. Here is code for my action mapping :
    <action path="/locator/locatorYearAction" name="locatorForm"
                   input="/locator/locatorMain.jsp"
                   type="com.apps.sales.web.salesin.actions.LocatorAction"
                   parameter="method" validate="true">
                   <forward name="showCarlines" path="/locator/locatorMain.jsp"
                        redirect="false" />
                   <forward name="showModels" path="/locator/locatorModels.jsp"
                        redirect="false" />     
              </action>

  • How to set a default value in a Value Help Drop Down List

    Hi,
    I used an age Range field in my adobe form, the control  is a Value Help Drop Down List. i am populating the drop down using following code.
    IWDAttributeInfo ageInfo = wdContext.nodePersonalData().getNodeInfo().getAttribute("CTAgeRange");
         ISimpleTypeModifiable ageType = ageInfo.getModifiableSimpleType();     
         IModifiableSimpleValueSet ageValueSet =  ageType.getSVServices().getModifiableSimpleValueSet();
         ageValueSet.put("1","21-29");
         ageValueSet.put("2","30-34");
         ageValueSet.put("3","35 or Above");
    My requirement is to set a default value e.g. 30-34 in the age range field.
    I want to give input to iform from my Implementation code only.
    Please help.
    Thanks in advance

    hi Ranjan,
    that means you have to set at design time,
    to set default drop down value you will have to set the value for particular attribute (which is linked to the dropdown element) in the context
    like
    wdContext.currentContext<nodeName>Element.set<FieldName>(<default value>)
    This generally done in Initialization method of the controller.

  • Drop Downs in adobe forms using Web dynpro ABAP

    Hi all,
    Im new to this adobe forms using webdynpro abap.
    In my requirement i have two drop downs on the form.
    by selecting value in one drop down i have to fill corresponding values in the other drop down.
    Using only WDA i know how to do this but with adobe i dnt know how and where i have
    to catch the drop down value and write my code. please let me know how i can achieve this.
    one more thing whatever action or events we are performing on the form where we have to place our code for this?
    Thanks,
    santosh

    hope this helps -
    [Thread: Populating one Drop-Down list from the selection of another Drop-down list |Populating one Drop-Down list from the selection of another Drop-down list;

  • How can i link two drop down buttons added dynamically

    guys got a wired problem but plz help.
    i m using jbuilder to create m y website.
    in this i got 2 drop down buttons.
    when the 1st(p1) 1 is clicked then second 1(a1) shows value respective of the value clicked in 1st 1.
    i dynamically add similar drop dowm on click of a button.
    but when value in the new drop down is selected (p2) it shows changes in 1st drop down (a1) not in newly created drop down(a2)
    could u guys plz help me out.
    its really urgent

    this is the code i m using to create the drop down
    ->
    var i=0;
    var option=new Array();
    function insRow(){
    var d=document.getElementById("div");
    d.innerHTML+="<select id='D"+i+"' class='input' onChange='getSh(this.selectedIndex)'><option>Select Here</option>"+
    <%
    rs=st.executeQuery("select * from productTab");
    while(rs.next())
    %>
    "<option><%=rs.getString("productName")%></option>"+
    <%}%>
    "</select>"
    d.innerHTML+="<select name='DD"+i+"' id='DD"+i+"' class='input'><option>Select Here</option></select>"
    d.innerHTML+="<select name='DDD+i' id='DDD+i' class='input'><option>Select Here</option></select>"
    d.innerHTML+="<input type=text name='T+i' id='T+i' class='input-time'><br>"
    option +=["DD"+i];
    option +=["D"+i];
    i++;
    function getSh(selectedcitygroup)
    document.getElementById("DD+i").options.length=1
    if(selectedcitygroup>0){
    for(i=0;i<cities[selectedcitygroup].length; i++)
    document.getElementById("DD+i").options[document.getElementById("DD+i").options.length]=new Option(cities[selectedcitygroup].split("|")[0], cities[selectedcitygroup][i].split("|")[1])

  • Unable to capture data from drop down list in custom added field in migo tcode at item level

    Hi guys,
    need bit help in resolving query related to custom added field in Tcode migo.
    i have added a field in migo at item level ,in this i have used drop down list
    to get data but unable to capture data from drop down list.gown through
    many blogs in scn but unable to resolve.
    Please help me out in this.
    Thanks,
    Umakant.

    Hi,
    U can use following code to fill the list box
    write this code in PBO
    In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
    TYPE-POOLS vrm.
      DATA values TYPE vrm_values WITH HEADER LINE.
      TABLES: <ur custom Database table>.
      clear values, values[].
      SELECT * FROM <ur custom Database table>.
        values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
        values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
        APPEND values.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = '<SCREEN INPUT FIELD NAME>'
          values          = values[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    Also please define the following before accessing the listbox value
    data: <listbox input field name> type <table field name>,
            <inputfield name where text to display> type string  in top include
    In PAI, select the text from the table into <inputfield name where text to display>  depending on value selected which will be called when enter key is pressed or any vale is selected

Maybe you are looking for