473,406 Members | 2,259 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,406 software developers and data experts.

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="saverecord" value="push me to save">

Then I'd retrieve it using something like:

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

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

Nov 18 '05 #1
4 4251
IsPostBack()

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Jiho Han" <ji******@infinityinfo.com> wrote in message
news:Oe**************@TK2MSFTNGP09.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="saverecord" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("saverecord") <> "" 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 "postbacking", 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******@infinityinfo.com> wrote in message
news:Oe**************@TK2MSFTNGP09.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="saverecord" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("saverecord") <> "" 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@localhost> wrote in message
news:OX**************@TK2MSFTNGP10.phx.gbl...
There is a difference? From my experience, if I'm "postbacking", 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******@infinityinfo.com> wrote in message
news:Oe**************@TK2MSFTNGP09.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="saverecord" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("saverecord") <> "" 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("myPostedValue"), 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******@infinityinfo.com> wrote in message
news:OI**************@tk2msftngp13.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@localhost> wrote in message
news:OX**************@TK2MSFTNGP10.phx.gbl...
There is a difference? From my experience, if I'm "postbacking", 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******@infinityinfo.com> wrote in message
news:Oe**************@TK2MSFTNGP09.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="saverecord" value="push me to save">

Then I'd retrieve it using something like:

' pseudo code
If Request.Form("saverecord") <> "" 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
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...
2
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...
2
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...
2
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...
2
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...
21
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...
4
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...
7
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.