HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

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 ASP Free Forums Sponsor:
  #1  
Old November 13th, 2003, 07:13 PM
webber webber is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 webber User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to webber
Validation - need help!

Hi there, im learning java, so forgive me if this sounds very n00bish, and help would be greatly appreciated :P

im looking to a registration for my website for users to log in, and some feilds are required

<form name="createcustomer" action="cprocess.asp" method="post">
<input name="fname" type="text" size="40"> * required
<input name="lname" type="text" size="40"> * required
<input name="company" type="text" size="40">
<input name="email" type="text" size="40"> * required
<input name="address" type="text" size="40">
<input name="suburb" type="text" size="40">
<input name="postcode" type="text" size="40">
<input name="state" type="text" size="40">
<input name="phone" type="text" size="40"> * required
<input name="fax" type="text" size="40">
<input name="mob" type="text" size="40">
<input type="checkbox" name="checkbox" value="checkbox"> * required - to agree with some terms

how can i validate this using java?

Reply With Quote
  #2  
Old November 29th, 2003, 08:05 AM
dev257 dev257 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Chandigarh
Posts: 55 dev257 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 48 sec
Reputation Power: 5
the information given is not complete however i 'll try to my best as it looks to me .i am assuming that you are using jsp.because java alone could not be used for web applications.
however if you are using jsp even then you would be requing client side scripting language like javascript to do the validation .


you will be requiring to do the following
you can place this opening script and closing tag any where in the html file but try to keep it before the form starts .
<script>
function chk()
{
/*put all your validation code here return false if an error is found else return true on the last line of the function. an example is shown so that the user could not leave his name empty*/

if(win.form.fname.value=="")
{
alert("Please enter your fname");
return false;
}
else if(win.form.lname.value=="")
{
alert("Please enter your lname");
return false;
}
else if(win.form.email.value=="")
{
alert("Please enter your email
return false;
}
else if(win.form.phone.value=="")
{
alert("Please enter your phone");
return false;
}
return true;
}
</script>

now in the form tag add an attribute named onSubmit like
<Form name="" action="" onsubmit="return chk()">



if there is an error generated by the chk() function the user will be forced to make corrections and the form will not be submitted.

Reply With Quote
  #3  
Old December 1st, 2003, 12:57 PM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
Java or JavaScript??

Are you dealing with

public static void main(String args[]) {} or <script> in your syntax??

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Validation - need help!


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 2 hosted by Hostway