How do I cancel Frontpage form submission?

A

Alex567

I have a Frontpage form. When the user clicks "Submit" I run a VBScript to
check the user input. If the data is unacceptable I want to cancel the page
submission to the server and present a "Sorry" page. I know how to redirect
to the "Sorry" page but how do I cancel the form submission?

Thanks in advance for any help.
 
J

Jens Peter Karlsen [FP-MVP]

Return false.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
A

Alex567

Thanks Jens,

Sorry if I appear dim but I am quite inexperienced and when I added "Return
false" to my VBScript it was ignored so I assume there must be more code
required to make it work.

Do I to put an object reference before the "Return false" part.

I am normally using "document.FrontPage_Form1.<control ID>" to check for
user inputs. Do I have to do the same here?

Can you provide the precise syntax required or point me to where I might
look it up myself?

Thanks again
 
S

Stefan B Rusynko

For global browser support you should be using JavaScript for client side validation
See http://irt.org/script/form.htm#5
If you are doing server side validation w/ VBscript
- on the receiving page (form action page)
<%
If Request.Form("yourformfieldname") <> "some_expected_value" Then
response.redirect "yourformpage.asp"
End if
%>

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Thanks Jens,
|
| Sorry if I appear dim but I am quite inexperienced and when I added "Return
| false" to my VBScript it was ignored so I assume there must be more code
| required to make it work.
|
| Do I to put an object reference before the "Return false" part.
|
| I am normally using "document.FrontPage_Form1.<control ID>" to check for
| user inputs. Do I have to do the same here?
|
| Can you provide the precise syntax required or point me to where I might
| look it up myself?
|
| Thanks again
|
|
|
| "Jens Peter Karlsen [FP-MVP]" wrote:
|
| > Return false.
| >
| > Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
| >
| > On Tue, 18 Apr 2006 07:09:02 -0700, Alex567
| >
| > >I have a Frontpage form. When the user clicks "Submit" I run a VBScript to
| > >check the user input. If the data is unacceptable I want to cancel the page
| > >submission to the server and present a "Sorry" page. I know how to redirect
| > >to the "Sorry" page but how do I cancel the form submission?
| > >
| > >Thanks in advance for any help.
| >
 
A

Alex567

Thanks for your time Stefan

I am doing client side validation using vbscript while I learn ASP.net. I am
not overly concerned with the small numbers using browsers other than IE in
the short term. There is no point in learning Javascript now.

What I am trying to do is check the user input and redirect out of the form
submission to my "Sorry" page if the answers are unacceptable.

I need the syntax for:

If <condition test> <> "what i want" then
<Cancel the form submission code here>
window.location.href = "Sorry.htm"
end if

My form is called "FrontPage_Form1"
 
A

Alex567

Here is some Javascript (my very first effort). Can anyone tell me why it
doesn't work?

</script>
<SCRIPT LANGUAGE="JavaScript"><!--
function CheckResults() {

if (document.FrontPage_Form1.Cat1None.checked == true)
return true;
else
if (document.FrontPage_Form1.Cat2More.checked == true)
return true;
else
if (document.FrontPage_Form1.ClaimsMore.checked == true)
return true;
else
{
return false;
window.location.href = "Sorry.htm"
}



}
//--></SCRIPT>



Alex567 said:
Thanks for your time Stefan

I am doing client side validation using vbscript while I learn ASP.net. I am
not overly concerned with the small numbers using browsers other than IE in
the short term. There is no point in learning Javascript now.

What I am trying to do is check the user input and redirect out of the form
submission to my "Sorry" page if the answers are unacceptable.

I need the syntax for:

If <condition test> <> "what i want" then
<Cancel the form submission code here>
window.location.href = "Sorry.htm"
end if

My form is called "FrontPage_Form1"

Stefan B Rusynko said:
For global browser support you should be using JavaScript for client side validation
See http://irt.org/script/form.htm#5
If you are doing server side validation w/ VBscript
- on the receiving page (form action page)
<%
If Request.Form("yourformfieldname") <> "some_expected_value" Then
response.redirect "yourformpage.asp"
End if
%>

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Thanks Jens,
|
| Sorry if I appear dim but I am quite inexperienced and when I added "Return
| false" to my VBScript it was ignored so I assume there must be more code
| required to make it work.
|
| Do I to put an object reference before the "Return false" part.
|
| I am normally using "document.FrontPage_Form1.<control ID>" to check for
| user inputs. Do I have to do the same here?
|
| Can you provide the precise syntax required or point me to where I might
| look it up myself?
|
| Thanks again
|
|
|
| "Jens Peter Karlsen [FP-MVP]" wrote:
|
| > Return false.
| >
| > Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
| >
| > On Tue, 18 Apr 2006 07:09:02 -0700, Alex567
| >
| > >I have a Frontpage form. When the user clicks "Submit" I run a VBScript to
| > >check the user input. If the data is unacceptable I want to cancel the page
| > >submission to the server and present a "Sorry" page. I know how to redirect
| > >to the "Sorry" page but how do I cancel the form submission?
| > >
| > >Thanks in advance for any help.
| >
 
J

Jens Peter Karlsen [FP-MVP]

if (document.FrontPage_Form1.Cat1None.checked == true)
return true;
else if (document.FrontPage_Form1.Cat2More.checked == true)
return true;
else if (document.FrontPage_Form1.ClaimsMore.checked == true)
return true;
else {
window.location.href = "Sorry.htm"
return false;
}

You never did the redirect because you returned from the function
prematurely.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

Here is some Javascript (my very first effort). Can anyone tell me why it
doesn't work?

</script>
<SCRIPT LANGUAGE="JavaScript"><!--
function CheckResults() {

if (document.FrontPage_Form1.Cat1None.checked == true)
return true;
else
if (document.FrontPage_Form1.Cat2More.checked == true)
return true;
else
if (document.FrontPage_Form1.ClaimsMore.checked == true)
return true;
else
{
return false;
window.location.href = "Sorry.htm"
}



}
//--></SCRIPT>



Alex567 said:
Thanks for your time Stefan

I am doing client side validation using vbscript while I learn ASP.net. I am
not overly concerned with the small numbers using browsers other than IE in
the short term. There is no point in learning Javascript now.

What I am trying to do is check the user input and redirect out of the form
submission to my "Sorry" page if the answers are unacceptable.

I need the syntax for:

If <condition test> <> "what i want" then
<Cancel the form submission code here>
window.location.href = "Sorry.htm"
end if

My form is called "FrontPage_Form1"

Stefan B Rusynko said:
For global browser support you should be using JavaScript for client side validation
See http://irt.org/script/form.htm#5
If you are doing server side validation w/ VBscript
- on the receiving page (form action page)
<%
If Request.Form("yourformfieldname") <> "some_expected_value" Then
response.redirect "yourformpage.asp"
End if
%>

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Thanks Jens,
|
| Sorry if I appear dim but I am quite inexperienced and when I added "Return
| false" to my VBScript it was ignored so I assume there must be more code
| required to make it work.
|
| Do I to put an object reference before the "Return false" part.
|
| I am normally using "document.FrontPage_Form1.<control ID>" to check for
| user inputs. Do I have to do the same here?
|
| Can you provide the precise syntax required or point me to where I might
| look it up myself?
|
| Thanks again
|
|
|
| "Jens Peter Karlsen [FP-MVP]" wrote:
|
| > Return false.
| >
| > Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
| >
| > On Tue, 18 Apr 2006 07:09:02 -0700, Alex567
| >
| > >I have a Frontpage form. When the user clicks "Submit" I run a VBScript to
| > >check the user input. If the data is unacceptable I want to cancel the page
| > >submission to the server and present a "Sorry" page. I know how to redirect
| > >to the "Sorry" page but how do I cancel the form submission?
| > >
| > >Thanks in advance for any help.
| >
 

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