Required fields

Posted on 1999-07-07
Medium Priority
Last Modified: 2010-04-09
Was wondering.... when setting up a form is there a way to require a field on the client side?

Question by:bhehir
  • 2

Expert Comment

ID: 1851655
Do you mean require that a field be filled in before the form can be submitted?  If so, it is certainly possible; if not, can you explain a little more fully what you mean.  Forms are designed and delivered by the server.


Accepted Solution

JCOLE earned 200 total points
ID: 1851656
I would suggest using a JavaScript function to validate required fields.

1) In the FOR tag, "onsubmit = return MyValidFunction()"
2) The Javascript function could be structured similar to this :

 if (document.FormName.FieldName.value.length==0) {
    alert("Please fill in the required field");
    return false;
    return true

Hope this answers your question.

Expert Comment

ID: 1851657
Yes.  How do you want to do it?  It can be done with JavaScript or CGI.

CGI is ideal (if you can have a CGI script on your server)

Expert Comment

ID: 1851658
Correction to my earlier response: I said to use the FOR tag. I meant to say use the FORM tag. Sorry about that.

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

607 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