Solved

Making html form fields required

Posted on 2002-03-14
2
255 Views
Last Modified: 2010-08-05
Hi,I have a simple html form that passes 6 variables to a servlet. I would like to make the variables required. I have no preference if I do this in the html or in the servlet. The best solution would use an input box and the minimal solution would just display text telling the user to enter the correct data.

Thanks,
Funim
0
Comment
Question by:funim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
Venci75 earned 100 total points
ID: 6864859
try this in your html page:
<script language="javascript">
<!--
function check_form() {
if (my_form.fld1.value == '') {
  alert('fld1 is empry');
  return false;
}
}
-->
</script>
<Form name="my_form" action="..." method=post onSubmit="return check_form()">
<input type="text" name=fld1>
<input type="submit">
</Form>
<body>
0
 

Author Comment

by:funim
ID: 6864925
Exactly what I was looking for, Thanks -Funim
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
spring jars download 1 68
difference between sorce folder and folder in eclipise 3 65
Is there a simpler dropbox system? 10 53
Crystal Reports Licensing Questions 4 89
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question