asp/javascript question

  • Thread starter Thread starter Curt_C [MVP]
  • Start date Start date
A couple of quick things here:

The form can be disabled to the end user, but the form's control values can
still be accessed via code (Request.Form / Request.QueryString).

A button's value is retrieved just like any other form element:
Request.Form("buttonID") or Request.QueryString("buttonID")

I've modified your code a little, removing the "all" qualifier (this is not
supported in NetScape) and instead use the form array's "elements" array.


<script language="javascript" type="text/javascript">
function submitOrder() {
var formStuff = order_form.elements
var count = formStuff .length
for ( var i = 0 ; i < count; i++ )
{
try
{
formStuff .disabled = true
}
catch (ignore) { }
}
}
</script>
 
Bruno Alexandre said:
But I have in the page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
response.Write("- - - - - - - - - - - - - - - - -<br>")
for each item in request.Form
response.Write( item & ": " & request.Form( item ) & "<br>" )
next
response.Write("- - - - - - - - - - - - - - - - -<br>")
for each item in request.QueryString
response.Write( item & ": " & request.QueryString( item ) & "<br>" )
next
response.Write("- - - - - - - - - - - - - - - - -<br>")
%>

and I can't have nothing... not even a single bit, just the dotted line...
:(
so, how can you retrive the values?

the form is:

<form name="order_form" method="get" action=""
onSubmit="return(submitOrder());">

and I tried with

<form name="order_form" method="post" action=""
onSubmit="return(submitOrder());">

the page is in : http://208.21.165.173/portal/asp/test.asp


--

Bruno Alexandre
(Sintra, PORTUGAL)



Scott M. said:
A couple of quick things here:

The form can be disabled to the end user, but the form's control values can
still be accessed via code (Request.Form / Request.QueryString).

A button's value is retrieved just like any other form element:
Request.Form("buttonID") or Request.QueryString("buttonID")

I've modified your code a little, removing the "all" qualifier (this is not
supported in NetScape) and instead use the form array's "elements" array.


<script language="javascript" type="text/javascript">
function submitOrder() {
var formStuff = order_form.elements
var count = formStuff .length
for ( var i = 0 ; i < count; i++ )
{
try
{
formStuff .disabled = true
}
catch (ignore) { }
}
}
</script>


Bruno Alexandre said:
Hi guys,

Sorry about the off topic, but I can't find the ASP group just the ASP
dot NET



If I want to block a user to change a form after submiting, I add a
function that will disable the submit button, but when I'm getting the
form
collection (using post or get (form/querystring) I can't retrieve that
button value...
Is there any trick to do this?

Like https://www.cuworld.com/ webpage... Try to register as a free user
membership and after click the submit button check what hapend... They
disable all the form (checking the source code, they disable every form
input box) How can they retrieve the values if the form is disable?


<script language="javascript" type="text/javascript">
function submitOrder() {
var count = order_form.all.length;
for ( var i = 0 ; i < count; i++ ) {
try {
order_form.all.disabled = true;
}
catch (ignore) { }
}
}
</script>

All help is apreciate, and once again, I'm sorry about the offf topic,
this is pure ASP and the group is for ASP.NET...


 
their submit routine call form.submit, then disables the controls, then
cancels the original submit.

-- bruce (sqlwork.com)
 
The problem is that your FORM tags have their ACTION set to nothing. Which
means that the form data doesn't get submitted anywhere (including the Form
or QueryString collections).

I assume you want the user to stay at this page after they have submitted
the form data and want the form to become disabled after submitting the form
data, right?

If so, add the name of this asp page to the ACTION attribute of your form
(ie. ACTION="order.asp"). Now, because the page will be re-loaded from
scratch the second time, you will need a way to know that the form data has
been submitted and disable the form. Here is what I would do for the entire
page:

OrderForm.asp
========================================================
<%@Language="VBScript"%>
<% Option Explicit %>
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript" TYPE="Text/JavaScript">
function disableForm() {
var formStuff = order_form.elements
var count = formStuff .length
for ( var i = 0 ; i < count; i++ )
{
try
{
formStuff .disabled = true
}
catch (ignore) { }
}
}
</SCRIPT>
<HEAD>
<BODY>
<%
'Test to see if there is a value in the Form collection for the
submit button
'If there is, it must mean that the page is loading as a result of
the user submitting data
'and, in that case, we don't want the form controls to be enabled,
so
'we'll call the JS function that disables them.

If Request.Form("cmdSubmit") <> "" Then
Response.Write("<SCRIPT LANGUAGE='JavaScript'>")
Response.Write("disableForm()")
Response.Write("</SCRIPT>")
End If
%>

Your stuff here

<FORM NAME="order_form" METHOD="Post" ACTION="OrderForm.asp">

...Your form elements...

<INPUT TYPE="Submit" NAME="cmdSubmit" VALUE="Submit Order">

</FORM>
</BODY>

</HTML>

============================================================

Bruno Alexandre said:
But I have in the page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
response.Write("- - - - - - - - - - - - - - - - -<br>")
for each item in request.Form
response.Write( item & ": " & request.Form( item ) & "<br>" )
next
response.Write("- - - - - - - - - - - - - - - - -<br>")
for each item in request.QueryString
response.Write( item & ": " & request.QueryString( item ) & "<br>" )
next
response.Write("- - - - - - - - - - - - - - - - -<br>")
%>

and I can't have nothing... not even a single bit, just the dotted line...
:(
so, how can you retrive the values?

the form is:

<form name="order_form" method="get" action=""
onSubmit="return(submitOrder());">

and I tried with

<form name="order_form" method="post" action=""
onSubmit="return(submitOrder());">

the page is in : http://208.21.165.173/portal/asp/test.asp


--

Bruno Alexandre
(Sintra, PORTUGAL)



Scott M. said:
A couple of quick things here:

The form can be disabled to the end user, but the form's control values can
still be accessed via code (Request.Form / Request.QueryString).

A button's value is retrieved just like any other form element:
Request.Form("buttonID") or Request.QueryString("buttonID")

I've modified your code a little, removing the "all" qualifier (this is not
supported in NetScape) and instead use the form array's "elements" array.


<script language="javascript" type="text/javascript">
function submitOrder() {
var formStuff = order_form.elements
var count = formStuff .length
for ( var i = 0 ; i < count; i++ )
{
try
{
formStuff .disabled = true
}
catch (ignore) { }
}
}
</script>


Bruno Alexandre said:
Hi guys,

Sorry about the off topic, but I can't find the ASP group just the ASP
dot NET



If I want to block a user to change a form after submiting, I add a
function that will disable the submit button, but when I'm getting the
form
collection (using post or get (form/querystring) I can't retrieve that
button value...
Is there any trick to do this?

Like https://www.cuworld.com/ webpage... Try to register as a free user
membership and after click the submit button check what hapend... They
disable all the form (checking the source code, they disable every form
input box) How can they retrieve the values if the form is disable?


<script language="javascript" type="text/javascript">
function submitOrder() {
var count = order_form.all.length;
for ( var i = 0 ; i < count; i++ ) {
try {
order_form.all.disabled = true;
}
catch (ignore) { }
}
}
</script>

All help is apreciate, and once again, I'm sorry about the offf topic,
this is pure ASP and the group is for ASP.NET...


 
microsoft.public.inetserver.asp.general

I can probably help on this, but it is late. The ASP group is full of some
great guys.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
Hi guys,

Sorry about the off topic, but I can't find the ASP group just the ASP
dot NET



If I want to block a user to change a form after submiting, I add a
function that will disable the submit button, but when I'm getting the form
collection (using post or get (form/querystring) I can't retrieve that
button value...
Is there any trick to do this?

Like https://www.cuworld.com/ webpage... Try to register as a free user
membership and after click the submit button check what hapend... They
disable all the form (checking the source code, they disable every form
input box) How can they retrieve the values if the form is disable?


<script language="javascript" type="text/javascript">
function submitOrder() {
var count = order_form.all.length;
for ( var i = 0 ; i < count; i++ ) {
try {
order_form.all.disabled = true;
}
catch (ignore) { }
}
}
</script>

All help is apreciate, and once again, I'm sorry about the offf topic,
this is pure ASP and the group is for ASP.NET...
 
But I have in the page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
response.Write("- - - - - - - - - - - - - - - - -<br>")
for each item in request.Form
response.Write( item & ": " & request.Form( item ) & "<br>" )
next
response.Write("- - - - - - - - - - - - - - - - -<br>")
for each item in request.QueryString
response.Write( item & ": " & request.QueryString( item ) & "<br>" )
next
response.Write("- - - - - - - - - - - - - - - - -<br>")
%>

and I can't have nothing... not even a single bit, just the dotted line...
:(
so, how can you retrive the values?

the form is:

<form name="order_form" method="get" action=""
onSubmit="return(submitOrder());">

and I tried with

<form name="order_form" method="post" action=""
onSubmit="return(submitOrder());">

the page is in : http://208.21.165.173/portal/asp/test.asp


--

Bruno Alexandre
(Sintra, PORTUGAL)



Scott M. said:
A couple of quick things here:

The form can be disabled to the end user, but the form's control values can
still be accessed via code (Request.Form / Request.QueryString).

A button's value is retrieved just like any other form element:
Request.Form("buttonID") or Request.QueryString("buttonID")

I've modified your code a little, removing the "all" qualifier (this is not
supported in NetScape) and instead use the form array's "elements" array.


<script language="javascript" type="text/javascript">
function submitOrder() {
var formStuff = order_form.elements
var count = formStuff .length
for ( var i = 0 ; i < count; i++ )
{
try
{
formStuff .disabled = true
}
catch (ignore) { }
}
}
</script>


Bruno Alexandre said:
Hi guys,

Sorry about the off topic, but I can't find the ASP group just the ASP
dot NET



If I want to block a user to change a form after submiting, I add a
function that will disable the submit button, but when I'm getting the
form
collection (using post or get (form/querystring) I can't retrieve that
button value...
Is there any trick to do this?

Like https://www.cuworld.com/ webpage... Try to register as a free user
membership and after click the submit button check what hapend... They
disable all the form (checking the source code, they disable every form
input box) How can they retrieve the values if the form is disable?


<script language="javascript" type="text/javascript">
function submitOrder() {
var count = order_form.all.length;
for ( var i = 0 ; i < count; i++ ) {
try {
order_form.all.disabled = true;
}
catch (ignore) { }
}
}
</script>

All help is apreciate, and once again, I'm sorry about the offf topic,
this is pure ASP and the group is for ASP.NET...

 
Back
Top