473,394 Members | 1,703 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,394 software developers and data experts.

rePOST form data without using GET

Hi all,

I was wondering if there's a technique to use POST instead of GET to
send data back to a form so to refill it with user input after this
hasn't passed validation.

Any clues?

Thanks,
Lorenzo

Feb 24 '06 #1
5 2162
it all depends... Do you want to do the validation client side or
server side? If you do it client side, in JS you can return false
in the onsubmit event of the form which will prevent the form from
actually being submitted. If it has to be done on the server side,
then you should investigate using a hash table to store field name/
value pairs. JSON is a data definition language that should be of
interest to you here... You could bundle all the form data into a
single object and pass that back to the form and repopulate all of
the fields quickly in the onload of the window.

some useful links..

Information about JSON

http://www.json.org/

Information about Prototype. This should make dealing with your forms
a bit easier... think of the power you have with the ability to hit the
server and process the response without refreshing the whole page.

http://prototype.conio.net/
http://www.sergiopereira.com/articles/prototype.js.html

This library builds on prototype.js by letting you use CSS Selectors to
assign methods to your elements.

http://bennolan.com/behaviour/

D.
Feb 24 '06 #2

lb********@gmail.com wrote:
Hi all,

I was wondering if there's a technique to use POST instead of GET to
send data back to a form so to refill it with user input after this
hasn't passed validation.

Any clues?

Thanks,
Lorenzo


Yes.

If you code your form so that the values are populated with the
Request.Form variables, when it is first presented to users they will
be empty. On submission, assuming validation failed, if you show the
form again, the fields will be populated with the users submissions eg

<form action="" method="post">
<p>First Name: <input type="text" name="firstname"
value="<%=Request.Form("firstname")%>"></p>
<p>Surname: <input type="text" name="surname"
value="<%=Request.Form("surname")%>"></p>

etc

/P.

Feb 24 '06 #3

Paxton wrote:
If you code your form so that the values are populated with the
Request.Form variables, when it is first presented to users they will
be empty. On submission, assuming validation failed, if you show the
form again, the fields will be populated with the users submissions eg


Nice technique. I do most of my work in ColdFusion at this time and
this would not work so well... CF would complain about the vars not
being set initially, so there would be alof of CFParam tags...

D.
Feb 24 '06 #4

dNagel wrote:
Paxton wrote:
If you code your form so that the values are populated with the
Request.Form variables, when it is first presented to users they will
be empty. On submission, assuming validation failed, if you show the
form again, the fields will be populated with the users submissions eg


Nice technique. I do most of my work in ColdFusion at this time and
this would not work so well... CF would complain about the vars not
being set initially, so there would be alof of CFParam tags...

D.


I'm unfamiliar with CF. But in PHP you would have to check whether the
variable has been set to achieve this kind of thing, otherwise you
would get warnings:
value="<?php if isset($_POST['firstname']) { echo $_POST['firstname'];}
?>"

/P.

Feb 24 '06 #5

Paxton wrote:
If you code your form so that the values are populated with the
Request.Form variables, when it is first presented to users they will
be empty. On submission, assuming validation failed, if you show the
form again, the fields will be populated with the users submissions eg

<form action="" method="post">
<p>First Name: <input type="text" name="firstname"
value="<%=Request.Form("firstname")%>"></p>
<p>Surname: <input type="text" name="surname"
value="<%=Request.Form("surname")%>"></p>


Thanks Paxton, this is great stuff. First time I come across it...
don't think the docs on MSDN mention this.

Thanks again,
Lorenzo

Feb 24 '06 #6

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

Similar topics

1
by: Fresh Air Rider | last post by:
Hi Everyone Scenario A Webage has two dropdown lists, one for Suppliers and one for Products. When a user selects a supplier, it then populates the Products dropdown list with the relevant...
7
by: David Shorthouse | last post by:
I am attempting to create a "new account creation" asp, but would ideally like the routine to check the Access db for an existing email address and username (called UID below). The select query...
0
by: Doug | last post by:
This is a repost of an item that I still cannot resolve. I have 3 combo boxes. The first leads to the second to the third. When I have selected a value in the second box, the third box shows...
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
4
by: Fernando Chilvarguer | last post by:
Hi, I've been trying to figure this one out for a while and I'm stalled. Here's my scenario: - a Parent window with a datagrid on it. The datagrid has pagination enabled and has an "Edit"...
5
by: Adrian Parker | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
2
by: Gerry | last post by:
I have a combo box and I can populate it with my class of dat (the class allows me to store each userid,username called - see code below I want the user to select the dropdown and see the...
0
by: teddysnips | last post by:
I have Search form that allows users to retrieve records into a DataGrid. There are two search criteria - a Month and a Year, which are selected from drop-down lists. There is a server-side...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
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...
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...

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.