CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 onsubmit & javascript

Print topic Send  topic

Author Message
Peter E
Posted: 03/01/2002, 9:52 AM

Newbie question: where do I place javascript and where exactly do I place onSubmit="return FormCheck()" on my search.asp?

The searh page offers a Like '%...%' Input Operation in From Properties, but I want to prevent people from seeing the complete databasecontent when they enter nothing. So I try to include a form validation somehow.
AudiTT @ Mci
Posted: 03/01/2002, 9:59 AM

Peter,

I will try to help. You can make the search field "Required" and that will eliminate the blank entries. Also, you can add the javascript function to the fotter of the actual form, and then you will have to edit the souce code file to add the on commmand.

A better alterneative is to search for a Custom Form Validation on this thread. This will help alot and allow you to keep from making custom code changes.

Bryan
Peter E
Posted: 03/01/2002, 10:06 AM

Bryan,

1.My search field shows 'required', but I think this doen't seem to work together with Like %...% (at least I don't see the results when entering nothing)

2. isn't there another way to add the onsubmit part? I like to keep everything inside CC...

3. I spend a 1 hour trying to find a clear answer somewhere in these threads, found some good hints, but not precise enough to help me out...


Peter E.

Nicole
Posted: 03/04/2002, 1:57 AM

Peter,
I think it make sense to check the value of search field using JavaScript. Javascript is to be entered to form's footer section. Here is sample code:
<script language = "JavaScript">
document.Search.onsubmit = validate;

function validate()
{
var tmp;
tmp = document.Search.name.value;
if (parseInt(tmp.length) == 0)
{
alert('The name field is empty. Please fill it!');
return false;
}
}
</script>

Where "Search" is the name of search form. "name" is search field name.
Peter E
Posted: 03/05/2002, 6:31 AM

This is a great solution to a lot of searching Nicole! Thanks!
But have you tried to input a single space and then enter...? This will still show the entire database...

Any solution for that maybe?

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.