Home Answers Viewqa JavaScriptQuestions Validate select tag Items

 
 


Cirrus
Validate select tag Items
1 Answer(s)      5 months and 15 days ago
Posted in : JavaScript Questions

Hi, How to validate addition of two numbers of two different "select" tag items in JavaScript..?

Thanks in advance.

View Answers

December 7, 2012 at 3:38 PM


Here is an example that validates HTML select tag and find the addition of two numbers selected from the select tag.

<html>
        <script language = "Javascript">
         function validate(){
            if(document.form.n1.selectedIndex==""){
            alert ( "Please select first number!" );
            return false;  
           }
           if(document.form.n2.selectedIndex==""){
            alert ( "Please select second number!" );
            return false;  
           }
           var v1=document.form.n1.value;
           var v2=document.form.n2.value;
           var sum=parseInt(v1)+parseInt(v2);
           alert("Sum of two numbers: "+sum);
            return true;
          }
        </script>
        <form name="form" method="post" onSubmit="return validate()">
        <pre>
        Select Number1    <select name="n1">
                          <option value="Select">Select</option>
                          <option value="10">10</option>
                          <option value="20">20</option>
                          <option value="30">30</option>
                          <option value="40">40</option>
                          <option value="50">50</option>
                          </select>
        Select Number2    <select name="n2">
                          <option value="Select">Select</option>
                          <option value="60">60</option>
                          <option value="70">70</option>
                          <option value="80">80</option>
                          <option value="90">90</option>
                          <option value="100">100</option>
                          </select>

                          <input type="submit" name="Submit" value="Submit">
        </pre>
        </form>
</html>









Related Pages:
Validate <select> tag Items
Validate select tag Items  Hi, How to validate addition of two numbers of two different "select" tag items in JavaScript..? Thanks in advance
Validate <select> tag Items
Validate select tag Items  Hi, How to validate addition of two numbers of two different "select" tag items in JavaScript..? Thanks in advance
validate select tag items in javascript
validate select tag items in javascript  Hi, How to validate addition of two numbers from two different <select> tag items in JavaScript..? Thanks in advance
JavaScript validate select tag
JavaScript validate select tag In this tutorial, you will learn how to validate html select tag. Here, we have used two select tags to select numbers...="return validate()"> <pre> Select Number1 <select name
validate select option jquery
validate select option jquery  How to Validate select option in JQuery
Select Tag (Form Tag) Example
Select Tag (Form Tag) Example       In this section, we are going to describe the select tag. The select tag is a UI tag that is used to render an HTML input tag of type select. Add
struts2 select tag multiple
struts2 select tag multiple  struts2 select tag multiple
The select tag
In this section, you will learn about the select tag of Spring form tag library
JSF selectItems Tag
JSF selectItems Tag          This tag is used to add a set of items to the nearest enclosing parent (select one or select many) component. This tag can be used
select tag multiple values
select tag multiple values   I want to insert multiple values in database which i have selected from select tag
about select tag
about select tag  Hi, i have a doubt regarding the usage of select tag,that is,suppose i am having two dropdown boxes,based on the selection of one dropdown item another dropdown item will be displayed without interacting
Display items in table
Display items in table  I have a listbox which has some items in it and a button. I select some items and click the button. They are displayed in a table. I want these items to be displayed in the table to be unique...i.e. if I
JSF selectManyMenu Tag
will be discussed. This is used to select more than one items from a set of options... in different browsers. In Internet Explorer browser user can select the items by scrolling...="select one or more items">   <f:selectItem id="si1" itemLabel
nested select tag
nested select tag  My requirement is as follows suppose combobox to select country whenever i select a country it will show corresponding states...; </head> <body> <select name='country
JSF selectManyCheckbox Tag
JSF selectManyCheckbox Tag      This section is to describe you selectManyCheckbox tag of JSF. It is used to provide the user to select many items from a list of options. The user can
Tomahawk selectManyCheckbox tag
; It is used to provide the user to select many items from a list of options. The user can select one or more options. This supports two layouts "...Tomahawk selectManyCheckbox tag  
Select Tag&lt;html:select&gt;:
html:select Tag : Creates a HTML <select> element, associated with a bean property specified by our attributes. Select Tag<html:select>:       html:select Tag  : Creates
shoping items billng source code
for the billing, and the select items are added to the "bill.jsp" page...shoping items billng source code  Hi, I am doing a project on invoice...", here in this page i need to get the items from the data base with respect
shoping items billng source code
for the billing, and the select items are added to the "bill.jsp" page...shoping items billng source code  Hi, I am doing a project on invoice...", here in this page i need to get the items from the data base with respect
shoping items billng source code
for the billing, and the select items are added to the "bill.jsp" page...shoping items billng source code  Hi, I am doing a project on invoice...", here in this page i need to get the items from the data base with respect
shoping items billng source code
for the billing, and the select items are added to the "bill.jsp" page...shoping items billng source code  Hi, I am doing a project on invoice...", here in this page i need to get the items from the data base with respect
shoping items billng source code
for the billing, and the select items are added to the "bill.jsp" page...shoping items billng source code  Hi, I am doing a project on invoice...", here in this page i need to get the items from the data base with respect
select tag in Struts2 to handle Enums - Struts
select tag in Struts2 to handle Enums  I have an java enum in my object. I am trying to set its values from struts2 select tag. I tried with "#list... to handle enums in struts2 select tag ?   Hi friend, Code to solve
Tomahawk selectManyMenu tag
browser user can select the items by scrolling the arrow icon up and down but its...Tomahawk selectManyMenu tag          This is used to select more
How to add another option to the select tag using struts2 tag - Struts
How to add another option to the select tag using struts2 tag  Hi, How to add another option to select tag using tag. My scenario is : If the logged in user is admin then drop down should contain the normal list
JSP:select image for db and display in image tag
JSP:select image for db and display in image tag  Hi, i am new to this forum. My query is that, i am trying to display image in tag but i am..., but i am not able to use thin in tag of html
JSP:select image for db and display in image tag
JSP:select image for db and display in image tag  Hi, i am new to this forum. My query is that, i am trying to display image in tag but i am..., but i am not able to use this in tag of html
JSP:select image for db and display in image tag
JSP:select image for db and display in image tag  Hi, i am new to this forum. My query is that, i am trying to display image in image tag but i am... image, but i am not able to use this in img tag of html
Select tag to fetch data from oracle database
Select tag to fetch data from oracle database  I created a select box having more than one menus in the select box such as regnno, address and name of a student and when regnno is selected from the drop down list by a user
Validate
Validate   hi all..im a beginner java and i need some help from u guys.. Its about validate. My HR request BF = 'brought forward', leave cannot apply date greater than 31/03 of particular year. So, if the user apply the date
Combobox Tag (Form Tag) Example
Combobox Tag (Form Tag) Example       In this section, we are going to describe the combobox tag. The combo box is basically an HTML INPUT of type text and HTML SELECT grouped together to give you a combo
using a database to upload items - Java Beginners
is my code and the items i need in a database import javax.swing.*; import... Items On Console"); b1.addActionListener(new ActionListener(){ public void..."); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select
multiple select values
multiple select values   can you provide an example for multiple select values for html:select tag
Checkboxlist Tag (Form Tag) Example
Checkboxlist Tag (Form Tag) Example       In this section, we are going to describe the checkboxlist tag. The checkboxlist tag is a UI tag that creates a series of checkboxes from a list. Setup is like <
we want to send requiest to server by html select tag - JSP-Servlet
we want to send requiest to server by html select tag  how we can send requiest to server using html select tag. and pass the value also  Hi Request Information In JSP Request Method
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am a newbie to java and struts. In my application, I have a requirement like when i give some input in a textbox and click on a add link. It should be added
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am a newbie to java and struts. In my application, I have a requirement like when i give some input in a textbox and click on a add link. It should be added
how to validate all form field values at once.
how to validate all form field values at once.  how to validate all form field values at once. condition:no form field shold contain sometext("--select
Validate TextArea
Validate TextArea       In this section, you will learn how to validate your text area...; <td><font color="#000080"><b>Select
Tomahawk validateEmail tag
Tomahawk validateEmail tag          This tag is used to validate... is message tag is displayed like is the figure below : Html Source Code
Tomahawk validateEqual tag
Tomahawk validateEqual tag          This tag is used to validate...; </body> </html> This tag contains attributes
Java Swing: Validate radiobutton
Java Swing: Validate radiobutton In this tutorial, you will learn how to validate radiobuttons in Java Swing. Radio buttons are the group of buttons where... have to be added to ButtonGroup to allow to select only one button at a time
Add Items in JComboBox from Access Database - Java Beginners
Add Items in JComboBox from Access Database  Heelo Sir I want To add... Database Column name -Course Items -MBA,MCA,MBA IT,MBA FINANCE I want Load Database...(); ResultSet rs=st.executeQuery("Select coursename from course"); while
Textarea Tag<html:textarea>:
Textarea Tag<html:textarea>: Information on Textarea Tag       html:textarea Tag -is use to create  a textarea element. This tag is only valid when nested inside a form tag body
Multiple select box
Multiple select box  Hi, I need help in code for multiple select box. The multiple select box should be populated with the db values.The selection done in the multiple select box is to be moved to the text area provided a add
Tomahawk navigationMenuItems tag
Tomahawk navigationMenuItems tag          This tag is used to provide the menu items and sub items. This is the replacement of using many
Facelet repeat Tag
Facelet repeat Tag          This tag is used to iterate over the list of items. The name of list of items is specified by the EL expression in the value attribute
Optiontransferselect Tag (Form Tag) Example
. The Optiontransferselect tag is a UI tag that creates an option transfer select... select component. This tag contains various parameters: The label parameter... Optiontransferselect Tag (Form Tag) Example      
struts <html:select> - Struts
=db.getDbConnection(); PreparedStatement ps=con.prepareStatement("select Dealer_Code from op... in the Struts HTML FORM tag as follows: Thanks

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.