is it possible to forbid a word in a form in frontpage?

J

joe

I want to reject a field in a form when the email contains hotmail or
yahoo or aol or gmail can this be done in frontpage.
 
R

Ronx

It can be done with JavaScript validation - but if the user has javascript
disabled (likely if you are thinking of spammers) then the only solution is
server side scripting.
Server side scripting requires the use of PHP, "classic" ASP, asp.NET or
another language your host supports. FrontPage extensions cannot provide
the validation on the server.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 
H

Hot-text

reject the world,,, but you will get e-mails form Yahoo. aol, gmail, and
hotmail.........
For you will not stop spammers send you e-mails form all above @ ....
Reject One you may::::Be all.
At one time I was @roadrunner, but @comcast buy them out Now I @comcast
But I will All Be a @hotmail
 
J

joe

Thank guys, any javascript samples for this?
I am not worried about spammer. I put a security code on the form and
I ask the users to type it. So far it works. It is a simple text box.
 
H

Hot-text

<SCRIPT type="text/javascript">
var forbidden = new Array ("v[!i1]agra", "xen[!i1]c[o0@]l",
"c[i!1]al[i!1]s", "to", "forbid", "a", "word", "in","form","Here");
function checkForm (form){
var input = form.textarea.value;
var fail = false;
for (var i=0; i < forbidden.length; i++) {
Regex=eval('/'+forbidden+'/i');
if (Regex.test(input)){
fail = true; break;
}
}
if (fail) {
alert("hey, you can't put that here!")
return false; }
return true;
}
</SCRIPT>
<FORM name="myform" method="post" action="" onSubmit="return
checkForm(this);">
<TEXTAREA NAME="textarea" COLS="40" ROWS="5"></TEXTAREA>
<INPUT TYPE="submit">
</FORM>
 
J

joe

Thank Hot-text here is my script I had to change a few lines

<SCRIPT type="text/javascript">
var forbidden = new Array ("v[!i1]agra", "xen[!i1]c[o0@]l",
"c[i!1]al[i!1]s");
function checkForm (form){
var input = form.textarea.value;
var fail = false;

for (var i=0; i < forbidden.length; i++) {
Regex=eval('/'+forbidden+'/i');
if (Regex.test(input)){
fail = true; break;
}
}
if (fail) {
alert("Only corporate email addresses allowed.")
return false;
}else{
this.submit();
return true;
}
}
</SCRIPT>

and on the form
<FORM name="myform" method="POST" action="../_vti_bin/shtml.exe/news/
test.htm" onSubmit="checkForm(this);return false;" >
 
H

Hot-text

I see Joe it work that But the javascript is for Bad Words!

Here it targeting textarea that thes way you here it

function checkForm (form){
var input = form.textarea.value;
var fail = false;

Here it targeting text input

function checkForm (form){
var input = form.text.value;
var fail = false;
++++++++++++++++++++++++


But here the one for EMail
Look at<<<<>>> txt=document.isn.email.value; <<<<<< isn >>>is the form
name>>><<< I see your is...>>>myform<<<make it work Joe!

Your
Hot-Text

<Go in the head>
<script language="JavaScript" type="text/javascript">
/* This is, at best, a perfunctory test of email address
entry validity. Is there an "@" sign and sufficient
letters prefixing it. Alert user if questioned. */
function emailCheck() {
txt=document.isn.email.value;
if (txt.indexOf("@")<3){
alert("I'm sorry. This email address seems wrong. Please"
+" check the prefix and '@' sign.");
return false;
}
return true;
}

</script>
</head>
<Go In The body>
<form name="isn" onSubmit="return emailCheck()">

<input type="text" name="email" size="40" value=""
onBlur="emailCheck()"><br><br>


</form>
</body>
 
J

joe

Oh well it kind of worked for me since it disable the validation from
front page. So if I enable Frontapage validation I cant use the
script or may be there is another way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top