switching form data

Results 1 to 3 of 3

Thread: switching form data

  1. #1
    Jeremy Lowery Guest

    Default switching form data

    Why does the following work:<BR><BR>var strAction = new String(Request.Form("action"));<BR>if(strAction == "SendMessage")<BR>{<BR> SendMessage();<BR>}<BR>else if(strAction == "undefined" &#124&#124 strAction == "")<BR>{<BR> ShowUI();<BR>}<BR>else<BR>{<BR> Response.Write("Unhanbled page action.");<BR>}<BR><BR>and the following does not:<BR><BR>var strAction = new String(Request.Form("action"));<BR>switch(strActio n)<BR>{<BR>case "SendMessage":<BR> SendMessage();<BR> break;<BR>case "":<BR>case "undefined":<BR> ShowUI();<BR> break;<BR>default:<BR> Response.Write("Unhandled page action");<BR>}<BR><BR>It says Unhandled page action when I load the page with no form data. What gives?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: switching form data

    there&#039;s a fallthrough on the second case:<BR><BR>j

  3. #3
    Jeremy Lowery Guest

    Default RE: switching form data

    umm yes. That&#039;s the point. So it catches "" and "undefined". It&#039;s just like a boolean or.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts