Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > rePOST form data without using GET

Reply
Thread Tools

rePOST form data without using GET

 
 
lbolognini@gmail.com
Guest
Posts: n/a
 
      02-24-2006
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

 
Reply With Quote
 
 
 
 
dNagel
Guest
Posts: n/a
 
      02-24-2006
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.
 
Reply With Quote
 
 
 
 
Paxton
Guest
Posts: n/a
 
      02-24-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) 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.

 
Reply With Quote
 
dNagel
Guest
Posts: n/a
 
      02-24-2006

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.
 
Reply With Quote
 
Paxton
Guest
Posts: n/a
 
      02-24-2006

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.

 
Reply With Quote
 
lbolognini@gmail.com
Guest
Posts: n/a
 
      02-24-2006

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read data from enctype="multipart/form-data" form Kevin DeValck Ruby 1 05-17-2011 06:14 PM
REPOST: Error Using WMI to Get List of Shared Folders on the Server lecnac ASP .Net 1 04-24-2006 10:43 PM
Repost without error: Bought HP 4x6 Premium Plus photo paper that cost me 7 cents per sheet Renee Digital Photography 0 01-24-2005 03:08 PM
Repost: Merging external data with html (not dotnet) form Jim Adams ASP .Net 1 08-26-2004 01:45 AM
Post Data with Javascript and without using a form tag. Neo Javascript 2 09-16-2003 07:38 AM



Advertisments