[thelist] ASP - actions taken before redirect? (again)

darren darren at web-bitch.co.uk
Fri Sep 28 04:15:29 CDT 2001


On 28 September 2001 at 00:32:11, Warden, Matt <mwarden at mattwarden.com> wrote:

WM> On Sep 28, darren had something to say about Re[2]: [thelist] ASP - actions...

>>   if len(Request.Form("btnSubmit")) > 0 then

WM> <shiver />

<grin>

WM> what happens if I submitted your form by hitting 'enter'? you're relying
WM> on the client to go ahead and submit the button as if it were clicked. i
WM> honesetly don't know if most clients do that, but i dont care because i
WM> don't do it that way  =)

ermmmm...'cos it's the only thing on the form and clicking 'enter' in a
textarea just adds a new line??  Yeah, that's it!! ;>

ok, i have to fess up and admit that normally i do check
Request.ServerVariables("Request_Method"), but long hours of coding
turned my brain to mush...

though as a desperate grasp at saving myself...if you have multiple
buttons on the form and you want to see which one had been hit, you can
use the code that sends shivers down matts back! ;>

>> hopefully that's something approximating clear, my brain is beginning to
>> really dislike me!! ;>

WM> lord do i know that feeling! have you started to see the pink elves in
WM> your coffee yet? if not, wait a week or two...

when they started dancing with the pink rhinos i knew at that coding
mssql stored procs was a bad thing(tm)!  :>

6 hours sleep and a pint of fresh java and i'm feeling almost human
again.  anyone know where you can get mountain dew in the uk??  can't
find the stuff anywhere! :>

WM> http://evolt.org/article/webforms/17/10199/index.html

is damn fine...however...

   sField = Request.Form("Field")
   if isEmpty(sField) then
      ...
   end if

always comes back false as it has been initialized by assigning a
field value, even if that value is "" as "" is a valid value that isn't
empty.  someone else has already mentioned this on the article, so i
won't add another comment...

have a look at sgd's article which, i think, backs me up! :>

http://evolt.org/article/Empty_Nothing_and_Null_How_do_you_feel_today/17/346/index.html

WM> oh, and rate it too.
WM> as opposed to:
WM> oh, and rate it *two*.

will do, just as soon as i remember my password....<blush />

darren

and 'cos its more or less related...

<tip type="asp, debugging" author="darren" level="newbie">
   want to see what the form is sending back to your page, just enumerate
   the form collection.

      for each index in Request.Form
         Response.Write index & " - " & Request.Form(index) & "<br />"
      next

   it's not just the form collection that can be enumerated, the same
   thing works for:
      Application.Contents
      Session.Contents
      Request.QueryString
      Request.ServerVariables

   and if you want to display all the properties of a connection or
   object you just have to loop through them:

      for iCount = 0 to objConn.Properties.Count - 1
          Response.Write objConn.Properties(iCount).Name & " - " & _
             objConn.Properties(iCount).Value & "<br />"
      next

   stored procedure parameters can be also be accessed in a similar way:

      for iCount = 0 to objCmd.Parameters.Count - 1
          Response.Write objCmd.Parameters(iCount).Name & ", " & _
             objCmd.Paramters(iCount).Direction & " - " & _
             objCmd.Paramters(iCount).Type & " - " & _
             objCmd.Paramters(iCount).Size & " - " & _
             objCmd.Paramters(iCount).Value & "<br />"
      next

   great for making sure that the correct data is going to the correct
   place.
</tip>





More information about the thelist mailing list