Forum Moderators: open

Message Too Old, No Replies

Quick validation question

         

ganderla

9:38 pm on Dec 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there a quick code I can insert on a form that will not let a user pass if any of the form elements are blank and possibly focus on the one that is blank?

Thank you

defanjos

9:43 pm on Dec 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can try a search on your favourite SE - example [google.com]

CloudLong

2:53 pm on Dec 27, 2003 (gmt 0)

10+ Year Member



if you let me see your form, I may able to work it out. But I'll give you example instead then. for example your form name is "myform"

<head>
<!--
Code By "CodeFreak" Cloud - codefreak.proboards19.com - 2003
You may leave this part of code intact to show your gratitude or remove it
-->
<script language=javascript>
function valid()
{
if (document.myform.things.value=="")
alert("Please enter your things");
document.myform.things.focus();
return (false);
}
</script>

</head>

<body>

<form name=myform onsubmit="return valid();">

<input type=text name=things>

<input type=submit name=submit value=submit>

</body>

Hope you understand the example :]

davidanders

6:23 pm on Jan 10, 2004 (gmt 0)

10+ Year Member



[javascript.about.com...]
Form Validation Step-by-Step
Learn how to add validation to your site

[javascript.about.com...]
Form Field Validation
This series of functions provide common form field validation.  You customize the "validateForm" function to make calls to the following functions with your form fields.  If the validation fails, the functions will alert the user with a message and put the text input focus on the field with the error.

[javascript.internet.com...]
The JavaScript Source: Forms: Validation (No Alert)
Description: Stop displaying those annoying alert boxes with your JavaScript form validation. This script uses images to display any error messages to the user, c
Extract: alt text home forms validation no alert stop displaying... alert boxes with your javascript form validation this script uses images...
[javascript.internet.com...]

The JavaScript Source: Forms: Validation (password)
Description: This script works like our Password Verifier, however, it also checks for a minimum length and invalid characters.
Extract: alt text home forms validation password this script... password the javascript source forms validation password simply click...
[javascript.internet.com...] - 21KB - Sep 15, 2003.

JavaScript Form Validation Sample Code
... ALIDATION Form validation is one of the most common uses for JavaScript. JavaScript is ... intuitive to do form validation with JavaScript than with CGI ... Library of JavaScript functions for form validation. test.html ...
Description: Form validation is one of the most common uses for JavaScript. JavaScript is a quick, easy way to check a user's input for mistakes, typos, and the omission of required fields. Because validation takes place on the client machine, there's no delay for...
more hits from:  [developer.netscape.com...]

JavaScript form validation
... alert boxes with your JavaScript form validation. This script uses images ... alert boxes with your javascript form validation this script uses images ... document write home form s form validation use javascript to... that all elements ...
Description: Description: This form validation script will place a check in the checkbox next to a textbox in a form if the enty is valid. Includes basic form validation. Coo
[javascript-2.com...]

Stewshack - JavaScript Form Validation
Stewshack - JavaScript Form Validation Home ¦ Web ¦ JavaScript ... ways to validate a form. When the user enters ... first, and last name validation. It runs through every ... hitting enter causes a form to submit? For instance ...
Description: There are several ways to validate a form. When the user enters in some information and clicks the submit button, you can validate the form and tell the user what they did wrong. I would perfer it if the button was disabled
[stewshack.com...]

Zone One: JavaScript Form Validation
Form Validation Example This illustrates simple form validation. It will check certain fields to see that there is information in the field. If there isn't, then it will prompt the user indicating that they forgot to fill in a field and then will ...
Description: Form Validation Example This illustrates simple form validation. It will check certain fields to see that there is information in the field. If there isn't, then it will prompt the user indicating that they forgot to fill in a field and then will set the...
[zone0ne.com...]

Form Fields Validation Visit ¦ Rate ¦ Error 
Description: Complete form fields validation - text, numeric, select, checkbox, radio, email, credit card.
Platform(s): All   Price: Free   Visits: 8909  (~ 25/day)   Rating:   (2.78 after 185 votes)
[scriptsearch.com...]