473,586 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best way to check whether postback or form action submit?

What is the best way to check whether the page is simply a postback or the
form has been submit with the intention of doing something?

In the olden days, I used to check for a form field name used for the submit
button:

<input type="submit" name="saverecor d" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("s averecord") <> "" Then
' do action
End If

How are you guys doing this?
Thanks for any insights.
Jiho

Nov 18 '05 #1
4 4260
IsPostBack()

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Jiho Han" <ji******@infin ityinfo.com> wrote in message
news:Oe******** ******@TK2MSFTN GP09.phx.gbl...
What is the best way to check whether the page is simply a postback or the
form has been submit with the intention of doing something?

In the olden days, I used to check for a form field name used for the submit button:

<input type="submit" name="saverecor d" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("s averecord") <> "" Then
' do action
End If

How are you guys doing this?
Thanks for any insights.
Jiho

Nov 18 '05 #2
There is a difference? From my experience, if I'm "postbackin g", I always
have the intention of doing something. It's how you define the different
event handlers for the controls on your page that determines what happens.
And also checking for page.ispostback in page_load to make sure you don't
repeat whatever process your page goes through the first time it is loaded.

HTH,
--Michael
"Jiho Han" <ji******@infin ityinfo.com> wrote in message
news:Oe******** ******@TK2MSFTN GP09.phx.gbl...
What is the best way to check whether the page is simply a postback or the
form has been submit with the intention of doing something?

In the olden days, I used to check for a form field name used for the submit button:

<input type="submit" name="saverecor d" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("s averecord") <> "" Then
' do action
End If

How are you guys doing this?
Thanks for any insights.
Jiho

Nov 18 '05 #3
I didn't describe what I was trying to do clearly it seems.

Sometimes postbacks occur when you change your dropdowns or select an item
from a listbox, etc. which probably changes some state on the page but not
necessarily commit to the backend - i.e. write to DB.

That said, I realize that's what postback event handlers are for such as
button click event handler. The only thing is that I was trying to do
without the postback event handler for a particular situation. So for
example, if you have a client side button or menu item that don't have wired
event handler for some reason and submits a client side form, what would be
the best way to know whether that form was submitted for "commit" or for
"state change"? Ok, maybe we're going back in time to ASP days but I was
just wondering.

Thanks all.

"Michael Ramey" <raterus@localh ost> wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
There is a difference? From my experience, if I'm "postbackin g", I always
have the intention of doing something. It's how you define the different
event handlers for the controls on your page that determines what happens.
And also checking for page.ispostback in page_load to make sure you don't
repeat whatever process your page goes through the first time it is loaded.
HTH,
--Michael
"Jiho Han" <ji******@infin ityinfo.com> wrote in message
news:Oe******** ******@TK2MSFTN GP09.phx.gbl...
What is the best way to check whether the page is simply a postback or the form has been submit with the intention of doing something?

In the olden days, I used to check for a form field name used for the

submit
button:

<input type="submit" name="saverecor d" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("s averecord") <> "" Then
' do action
End If

How are you guys doing this?
Thanks for any insights.
Jiho


Nov 18 '05 #4
"So for example, if you have a client side button or menu item that don't
have wired event handler for some reason and submits a client side form."
Can you think of any good reasons for that? I can't.

Honestly, nothing is stopping you from getting values from
Request.Form("m yPostedValue"), but that is kinda old school asp there.
Everything should go through the event handlers on postbacks if you wanted
to keep with the OOP flow of the program. Gets pretty ugly if you stray
away from that.

--Michael

"Jiho Han" <ji******@infin ityinfo.com> wrote in message
news:OI******** ******@tk2msftn gp13.phx.gbl...
I didn't describe what I was trying to do clearly it seems.

Sometimes postbacks occur when you change your dropdowns or select an item
from a listbox, etc. which probably changes some state on the page but not
necessarily commit to the backend - i.e. write to DB.

That said, I realize that's what postback event handlers are for such as
button click event handler. The only thing is that I was trying to do
without the postback event handler for a particular situation. So for
example, if you have a client side button or menu item that don't have wired event handler for some reason and submits a client side form, what would be the best way to know whether that form was submitted for "commit" or for
"state change"? Ok, maybe we're going back in time to ASP days but I was
just wondering.

Thanks all.

"Michael Ramey" <raterus@localh ost> wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
There is a difference? From my experience, if I'm "postbackin g", I always
have the intention of doing something. It's how you define the different event handlers for the controls on your page that determines what happens. And also checking for page.ispostback in page_load to make sure you don't repeat whatever process your page goes through the first time it is

loaded.

HTH,
--Michael
"Jiho Han" <ji******@infin ityinfo.com> wrote in message
news:Oe******** ******@TK2MSFTN GP09.phx.gbl...
What is the best way to check whether the page is simply a postback or

the form has been submit with the intention of doing something?

In the olden days, I used to check for a form field name used for the

submit
button:

<input type="submit" name="saverecor d" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("s averecord") <> "" Then
' do action
End If

How are you guys doing this?
Thanks for any insights.
Jiho



Nov 18 '05 #5

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

Similar topics

5
46004
by: Matt | last post by:
I always see the term "postback" from ASP book, but I am not sure if I fully understand the meaning. Here's my understanding so far, please correct me if any mistakes. Here's a typical html form: <form action="process.asp" method="post"> 'GUI code </form> "postback" action happens when the user click the submit button, that means
2
1679
by: JR | last post by:
Hi. I have a CGI script that will need to call itself an unknown number of times, to add rows, run queries, etc. At the bottom of the output that is produced by the script, there are four buttons. I need one of the buttons to simply be a back button. I have this button working fine. I need the second and fourth buttons to point to the...
2
2925
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server where there is no scripts allowed running (the software is from Opentext called Livelink)- therefore I need javascript to do the tasks listed below:...
2
1618
by: Matthew Louden | last post by:
I want to know if the PostBack concept applies to HTML web-based forms, regardless of what programming technologies we use: For example, ASP, ASP.NET, Java, CGI, etc... PostBack means to send the HTML form to the web server? Since most of the time I heard this term in ASP.NET circle, thats why I raise this question. Please advise. Thanks!
2
4357
by: Jim Duncan | last post by:
How can I make a client-side javascript form.submit() look enough like a postback that the browser back button will not show the previous state of the form and instead go to the previous page? I have two forms on the page. The first is a server form (runat=server) and contains a Repeater control. One of the columns contains a checkbox for...
21
24425
by: Martin Eyles | last post by:
I am trying to get javascript to cause a page to post back. I have tried calling _doPostBack from my script, but generates an error "object expected". I think this is because the page's script doesn't contain the method _doPostBack, which needs to be added by asp.net. How can I make asp.net add this script? Thanks, ME --
4
2877
by: peshrad | last post by:
Hi ! I'm working with Win 2K and Visual Studio 2003. I have a problem because pressing <ENTER> in a text input control causes a postback of my web form. Here comes some example code (already stripped of most of the unnecessary code): ----------------------------------------------------------------------------
7
6977
by: h7qvnk7q001 | last post by:
I'm trying to implement a simple server-side form validation (No Javascript). If the user submits a form with errors, I want to redisplay the same form with the errors highlighted. Once the form is correct I need to submit to another page that uses the form data. I first tried making the form submit action= field point to the same file....
4
1700
by: Harry | last post by:
Hi, This aspx page (let's call it thispage.aspx) fetches data from a sqldatasource, then performs several things (in code-behind) and, to simplify, passes data from code-behind via a hiddenfield to a javascript in the aspx file. This javascript performs things and finally send data via a form to another database. My problem is that when...
0
8200
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8215
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.