Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Clearing Fields on Form


Message #1 by "Jonathan Mooney" <mooneyuuj@h...> on Sat, 15 Mar 2003 01:07:02 +0000
Hi there,

I creating a simple form to write to a DB, does anyone know the code to 
check a field for text and if it is empty stop the form from submitting and 
flag it up to the User!

For example I have a fields called UserName and Address (among many) how 
would I complete this check.

Also I have the user entering passwords and were they do not match does 
anyone know how to clear these fields to allow the user to re-enter their 
details.

If anyone knows a good tutorial link were I can learn more I would be 
grateful.


Many Thanks!
Jon



_________________________________________________________________
Chat online in real time with MSN Messenger http://messenger.msn.co.uk

Message #2 by "Josh Katsaros" <katsarosj@y...> on Sun, 16 Mar 2003 06:04:44
You can use client-side form validation.  Here is a vbscript example:

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--

Function FormName_onsubmit
	If document.FormName.TextBoxName.value = "" Then
		alert "You must enter a name in order to proceed!"
		FormName_onsubmit = False
		document.FormName.TextBoxName.focus
		Exit Function
	End If
End Function

-->
</SCRIPT>

Note that vbscript is not generally supported in Netscape.  Use javascript 
if you anticipate problems.  Also, this only validates on the client 
side.  If your user names and passwords are stored in a database, this 
information must be processed at the server(unless you process this 
information first and store that information in an array).  In other 
words, you need to post the form, validate user name and password on the 
server side, and if the user name and password are not found, redirect 
back to the original login page.

Hope this helps.

JK

> Hi there,

I creating a simple form to write to a DB, does anyone know the code to 
check a field for text and if it is empty stop the form from submitting 
and 
flag it up to the User!

For example I have a fields called UserName and Address (among many) how 
would I complete this check.

Also I have the user entering passwords and were they do not match does 
anyone know how to clear these fields to allow the user to re-enter their 
details.

If anyone knows a good tutorial link were I can learn more I would be 
grateful.


Many Thanks!
Jon



_________________________________________________________________
Chat online in real time with MSN Messenger http://messenger.msn.co.uk

Message #3 by "Jonathan Mooney" <mooneyuuj@h...> on Wed, 19 Mar 2003 10:20:39 +0000
Thanks Josh,

for all your help

Jon






>From: "Josh Katsaros" <katsarosj@y...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Re: Clearing Fields on Form
>Date: Sun, 16 Mar 2003 06:04:44
>
>You can use client-side form validation.  Here is a vbscript example:
>
><SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
><!--
>
>Function FormName_onsubmit
>	If document.FormName.TextBoxName.value = "" Then
>		alert "You must enter a name in order to proceed!"
>		FormName_onsubmit = False
>		document.FormName.TextBoxName.focus
>		Exit Function
>	End If
>End Function
>
>-->
></SCRIPT>
>
>Note that vbscript is not generally supported in Netscape.  Use javascript
>if you anticipate problems.  Also, this only validates on the client
>side.  If your user names and passwords are stored in a database, this
>information must be processed at the server(unless you process this
>information first and store that information in an array).  In other
>words, you need to post the form, validate user name and password on the
>server side, and if the user name and password are not found, redirect
>back to the original login page.
>
>Hope this helps.
>
>JK
>
> > Hi there,
>
>I creating a simple form to write to a DB, does anyone know the code to
>check a field for text and if it is empty stop the form from submitting
>and
>flag it up to the User!
>
>For example I have a fields called UserName and Address (among many) how
>would I complete this check.
>
>Also I have the user entering passwords and were they do not match does
>anyone know how to clear these fields to allow the user to re-enter their
>details.
>
>If anyone knows a good tutorial link were I can learn more I would be
>grateful.
>
>
>Many Thanks!
>Jon
>
>
>
>_________________________________________________________________
>Chat online in real time with MSN Messenger http://messenger.msn.co.uk
>


_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk


  Return to Index