SunQuest
           HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 18th, 2000, 04:11 PM
Dz9r_work Dz9r_work is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Utah
Posts: 2 Dz9r_work User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help... Simple question:
I have a form that gets submited to my send mail program but i want to make some fields requred and if they are not filled out then it will not let them submit the form help please
Chris
larson@cache.net

Reply With Quote
  #2  
Old August 23rd, 2000, 09:33 AM
pieux pieux is offline
Seņor Member
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2000
Posts: 1,156 pieux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m 59 sec
Reputation Power: 9
function checkFields() {
em = "The following field(s) cannot be blank: "
if (document.form.field1.value == "") em = em + "n * Text1";
if (document.form.field2.value == "") em = em + "n * Text2";
if (em.indexOf('*') > 0) {
alert(em);
return false;
}
}

Also, you want to make sure that code is inside SCRIPT tags and that you replace form with the name of your form, the field tags with the names of the fields, and Text with the actual Text you want displayed. Then, just add/remove lines to accomodate the number of fields for which you want the alert to show.

Reply With Quote
  #3  
Old August 25th, 2000, 05:44 AM
CyberOsc CyberOsc is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Indonesia
Posts: 87 CyberOsc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
<HEAD>
<script>
function validateForm(form)
{
if (!form.name.value)
{
alert("Fill it");
form.name.focus();
return false;
}

}
</HEAD>
<BODY>
<form action="filenm" method="post" onSubmit="return validateForm(this)">
<input type=text name="name">

<input type="submit">
</form>
</BODY>

</script>

------------------
CyberOsc
sphmjf_oscario@gurlmail.com

** It's the world of Oscario **

Reply With Quote
  #4  
Old August 25th, 2000, 05:49 AM
CyberOsc CyberOsc is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Indonesia
Posts: 87 CyberOsc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
sorry,

a little mistake in my code above.

it should be :

<HEAD>
<SCRIPT>
function validateForm(form)
{
etc.
}
</SCRIPT>
</HEAD>

<BODY>
etc
</BODY>

------------------
CyberOsc
sphmjf_oscario@gurlmail.com

** It's the world of Oscario **

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > HTML Forms


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway