Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 19th, 2007, 11:01 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default form validation

Hi,

Regarding form validation, does anyone know the code or what to do if you want only people with a certain username to be able to add to a database. So only people with the same email address extension can add entries into a database and if those email extensions dont match with a list, then the person gets a message saying invalid email. Onlypeople from company are be allowed into the website... thats why.

  #2 (permalink)  
Old January 20th, 2007, 08:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

What scripting are you wanting to use?

You can do it with a combination of ASP & Javascript; for example, something like this.

<%

if request.form("username") = "yourdomain.com" then

response.redirect("yourpage.asp")

else

%>

<script language="javascript">

window.alert("Invalid Username")

window.history.go(-1)

</script>


<form>form action="" method="post">

<input type="text" name="username">

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

</form>

  #3 (permalink)  
Old January 20th, 2007, 06:24 PM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Im using just JSP - cant use ASP because of the way the system is setup, but that code looks very good! Can you tell me what the JSP code equivalent of the ASP code in the if statement is please - that would be very helpful!!! ?:)

  #4 (permalink)  
Old January 20th, 2007, 06:27 PM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by EmWebs
 Hi,

Im using just JSP - cant use ASP because of the way the system is setup, but that code looks very good! Can you tell me what the JSP code equivalent of the ASP code in the if statement is please - that would be very helpful!!! ?:)

Opps I forgot to add.... whats the extra code you need if there are more than one permitted email addresses that can be inserted into the database, kind of the code for a.a@domain1.com OR a.a@domain2.com

Thanks

  #5 (permalink)  
Old January 21st, 2007, 01:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

I'm afraid I don't know the jsp equivalent - might have to search other forum's for that.

  #6 (permalink)  
Old January 22nd, 2007, 06:59 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

How good is form validation anyway? Will it always work?

I was doing some testing and for some reason it stopped working! It started allowing blanks in the table!

Do versions of IE 3+ only support validation?

  #7 (permalink)  
Old January 23rd, 2007, 10:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

It's usually pretty failsafe as long as the client machine has javascript switched on.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Form Validation Stanny Access VBA 5 December 20th, 2005 08:13 PM
Validation of Form qazi_nomi Javascript 5 August 2nd, 2004 03:49 PM
Form not refreshing after form validation Mimi Javascript How-To 0 August 25th, 2003 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.