Solved

Making html form fields required

Posted on 2002-03-14
2
256 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

632 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