473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

forms question

Hi,
I have a form with some fields and a submit button. The submit button posts
the results to itself, which are then processed. I have 2 questions:

1. Is it possible to have a series of button each of which changes one of
the items posted and then posts the form?
2. Is it possible to cause a "processing" banner to be displayed until the
page gets refreshed?

Thanks.
Jul 19 '05 #1
3 2361
Freeserve wrote:
Hi,
I have a form with some fields and a submit button. The submit
button posts the results to itself, which are then processed. I have
2 questions:

1. Is it possible to have a series of button each of which changes
one of the items posted and then posts the form?
Sure. This is a client-side code question and should have been posted to one
of the dhtml groups, but, assuming you;ve set the form's id property to
"myForm":
1. give your textbox an id (set its id property), say id="txt1"
2. give the button that controls that textbox a unique id, say id="cmd1"
3. In a script block, create a cmd1_onclick sub if you are using vbscript,
or function if jscript. Write the code to set the textbox's value property:
myForm.txt1.value = "something"
and call the form's submit method:
vbscript:
myForm.submit
jscript:
myForm.submit()

This is your last free pass :-)
In the future submit client-side code questions to the appopripriate
newsgroup and indicate which script language you intend to use.
2. Is it possible to cause a "processing" banner to be displayed
until the page gets refreshed?

There is a method which sometimes works, sometimes doesn't. It requires a
combination of server-side and client-side code:
Make sure buffering is on and then use response.flush to display your
message. Then do your processing and hide the message in the window's onload
event. Here is an example:

<%@ Language=VBScript %>
<%
Response.Buffer=true
%>
<%
if len(Request.Form("text1")) > 0 then
Response.Write "<div id=""divPrc"">Processing</div>"
Response.Flush
dim t
t=now
t=dateadd("s",3,t)
do until now > t
loop
else
//we need the div to be there - this message will never be seen
Response.Write "<div id=""divPrc"">" & "Nothing to process" & "</div>"
Response.Flush
end if
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function window_onload() {
divPrc.style.display="none";
/*the following line is optional - do not use this if you are submitting
to another page*/
MyForm.action=window.location;
}

//-->
</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onload="return window_onload()">

<form id="MyForm" method="post">
Enter some text and click submit:
<INPUT type="text" id=text1 name=text1>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</form>

</BODY>
</HTML>

Jul 19 '05 #2
Correction:
<%@ Language=VBScript %>
<%
Response.Buffer=true
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function window_onload() {
divPrc.style.display="none";
/*the following line is optional - do not use this if you are submitting
to another page*/
MyForm.action=window.location;
}

//-->
</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onload="return window_onload()">
<%
if len(Request.Form("text1")) > 0 then
Response.Write "<div id=""divPrc"">Processing</div>"
Response.Flush
dim t
t=now
t=dateadd("s",3,t)
do until now > t
loop
else
//we need the div to be there - this message will never be seen
Response.Write "<div id=""divPrc"">" & "Nothing to process" & "</div>"
Response.Flush
end if
%>

<form id="MyForm" method="post">
Enter some text and click submit:
<INPUT type="text" id=text1 name=text1>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</form>

</BODY>
</HTML>


Jul 19 '05 #3
Thanks for the info. I will try and get the correct group next time!

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:eX**************@TK2MSFTNGP11.phx.gbl...
Correction:
<%@ Language=VBScript %>
<%
Response.Buffer=true
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function window_onload() {
divPrc.style.display="none";
/*the following line is optional - do not use this if you are submitting
to another page*/
MyForm.action=window.location;
}

//-->
</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onload="return window_onload()">
<%
if len(Request.Form("text1")) > 0 then
Response.Write "<div id=""divPrc"">Processing</div>"
Response.Flush
dim t
t=now
t=dateadd("s",3,t)
do until now > t
loop
else
//we need the div to be there - this message will never be seen
Response.Write "<div id=""divPrc"">" & "Nothing to process" & "</div>"
Response.Flush
end if
%>

<form id="MyForm" method="post">
Enter some text and click submit:
<INPUT type="text" id=text1 name=text1>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</form>

</BODY>
</HTML>

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: KK | last post by:
Windows Forms Inheritance, Incomplete? I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can be used effectively if the...
2
by: KK | last post by:
** Posting it here cause after couple of days no body responded.** I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can...
6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
4
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1...
1
by: Sunil Sabir | last post by:
Dear All, I have 4 web ASP.net Forms. I use a image control to move between these forms.The problem I am facing is that I cannot preserve the state of the form when moving between different...
18
by: Rippo | last post by:
Hi I am using role base forms authentication in asp.net and have come across a problem that I would like advice on. On a successful login a session variable is set to identify a user. This is...
15
by: Alex | last post by:
Does anybody know why VB.NET would omit the Forms collection available in previous versions versions of VB? I imagine that there must be a reason why they decided to do away with it, but I can't...
8
by: =?Utf-8?B?TFc=?= | last post by:
Hello! I am just learning about forms authentication so please excuse this basic question. I am using .NET 1.1 and C#. I have created my web.config file and my login.aspx and the associated cs...
1
by: Troy Bull | last post by:
Greetings I am trying to use a singleton to hold a group of forms. I have a MDIMaster form. I have a class called Forms; Forms is a singleton. I want to do something like the following. In...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.