473,383 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Selection form with JavaScript

Hi,


I'm a beginner in javascript programing, but I guess that my problem is easy.
I'd like to make a dynamic selection form with some simple questions. I mean that a message pops up before hitting Submit. For example: Do you live in EU? Answer yes or no. It's easy but I want if anybody choose the "bad" answer a line or window appears and tells that "You are not eligable for selection" or something like this.

I hope somebody can help me!

Best regards
Nov 28 '10 #1
2 1760
RamananKalirajan
608 512MB
Use onsubmit in the form tag to trigger a function call before submitting a form. You can use confirm to get the input from user if you have only yes or no.

Thanks and Regards
Ramanan Kalirajan
Nov 29 '10 #2
Expand|Select|Wrap|Line Numbers
  1. <form name="form1" onsubmit="return check_me()">
  2.         Name :: <Input type="text" name="name1" value="" id="name1" />
  3.         <br />
  4.         Address :: <textarea></textarea>
  5.         <br />
  6.         City :: <input type="text" name="city" value="" id="city" />
  7.         <br />
  8.         <input type="submit" name="submit_btn" value="SUBMIT" />
  9.     </form>
  10.  
  11.  
  12. <script type="text/javascript">
  13.     function check_me()
  14.     {
  15.         if(confirm("Do you live in EU? "))
  16.         {
  17.             return true;
  18.         }
  19.         else
  20.         {
  21.             alert("You are not eligable for selection");
  22.             return false;
  23.         }
  24.     }
  25. </script>
May 17 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dalan | last post by:
I'm developing a report selection form and one of the elements of design is providing Date from/to text boxes. I have a Table that contains all of the information regarding the reports and did...
2
by: Dalan | last post by:
Okay, I have worked on this and then some, but cannot seem to crack it. So if someone can straighten my code out, or suggest a new approach, then I'm all ears. Here goes: I have two tables - one...
0
by: rocsolid | last post by:
Current problem deals with three tables in my database. The "DOCUMENTSLIST" table has a one-to-many relationship to the junction table (DOCUMENTS/PROJECTS) which, in turn, has a many-to-one...
4
by: Sean Connery | last post by:
I have a Microsoft UI Process Application Block that is controlling child forms in an MDI parent container. The views node in the app.config file has been set to stayOpen=false. Because there...
4
by: fredindy | last post by:
Hope the subject is sufficient. Here is what is going on. I need to create a form that will display data within a date range... no biggie. However, I'd like to keep it as close to the example...
5
by: Gerhard Heemskerk | last post by:
Hello, I have made a main form and a sub form. When I click on the ms access standard form filter button I get an error message stating that I can not assign a value to this object. The subform is...
3
by: rom15becs | last post by:
Hi everyone, I'm working on a project that uses 2 forms : one to select an object and one other to display its attributes. I mean that in the first one I select an object (from a ComboBox), then...
1
by: mrityunjay11 | last post by:
i want a date selection form in jsp and that variable should be caught in servlet that is how to catch date varible in my servlet. thanks a lot Regards mrityunjay singh
4
by: gblack301 | last post by:
Hi, I have a search form where the user can check a box or enter some data such as a name to quey the database. I was wondering what is the best way to enable the ability for a user data in more...
3
by: Hodld | last post by:
Hi, I'm creating a selection form with array data, using a for loop. This is my first time doing this, so it could be a pretty dumb mistake, but all the values end up printing on the line above...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.