asp.net form method confusion
Posted on 2003-03-28
I am writing a web page that allows the user to add a comment to a guestbook. Easy. What I am doing at the minute is simply running a _Click handler for my submit button that proceeds to open up a database connection and insert the new data. Once again easy.
However, with this method I cannot see the point in using FORM METHOD and ACTION specifiers. The only possible cause I can see to use FORM ACTION is to specify the name of the current script and then handle the parameters passed to it in the Page_Load method, eg
// Within thisScript.aspx
// Handle data from the query string with Request.QueryString(["<data parameter name>"])
<form METHOD=post ACTION=thisScript.aspx?<data parameters> >
However this is questionable as how would the data parameters be passed into the action tag when this is static HTML? Obviously a _Click handler could redirect (Repsonse.Redirect) the page to itself with the new data parameters that would be handled in Page_Load(), but then there would be no need for the FORM ACTION tag !
Can someone clarify the purpose of forms and end this confusion ?