Request.Form() - Return Value & Strings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Speight

    Request.Form() - Return Value & Strings

    Hello,

    In an ASP script Request.Form() returns a value fine.

    But I want to be able to chop the returned value up using substring.

    Having trouble getting the return into a String variable so I can do this.

    eg.

    var eDate;
    var sDD,sMM,sYYYY,s HH,sMI,sSS;

    eDate=Request.F orm("edate");
    sDD = eDate.substring (0, 2);
    sMM = eDate.substring (3, 5);
    sYYYY = eDate.substring (6, 10);

    Gives

    Error Type:
    Microsoft JScript runtime (0x800A01B6)
    Object doesn't support this property or method
    /sfdw/trw1.asp, line 156

    Could someone guide me please.

    Martin Speight.


  • Martin Honnen

    #2
    Re: Request.Form() - Return Value & Strings



    Martin Speight wrote:
    [color=blue]
    > Hello,
    >
    > In an ASP script Request.Form() returns a value fine.
    >
    > But I want to be able to chop the returned value up using substring.
    >
    > Having trouble getting the return into a String variable so I can do this.
    >
    > eg.
    >
    > var eDate;
    > var sDD,sMM,sYYYY,s HH,sMI,sSS;
    >
    > eDate=Request.F orm("edate");[/color]

    Use
    eDate = String(Request. Form("edate"))



    --

    Martin Honnen

    Comment

    • Martin Speight

      #3
      Re: Request.Form() - Return Value & Strings


      Thank you for your help

      Martin Speight

      "Martin Speight" <martinspeight@ onetel.net.uk> wrote in message
      news:416a606a@2 12.67.96.135...[color=blue]
      > Hello,
      >
      > In an ASP script Request.Form() returns a value fine.
      >
      > But I want to be able to chop the returned value up using substring.
      >
      > Having trouble getting the return into a String variable so I can do this.
      >
      > eg.
      >
      > var eDate;
      > var sDD,sMM,sYYYY,s HH,sMI,sSS;
      >
      > eDate=Request.F orm("edate");
      > sDD = eDate.substring (0, 2);
      > sMM = eDate.substring (3, 5);
      > sYYYY = eDate.substring (6, 10);
      >
      > Gives
      >
      > Error Type:
      > Microsoft JScript runtime (0x800A01B6)
      > Object doesn't support this property or method
      > /sfdw/trw1.asp, line 156
      >
      > Could someone guide me please.
      >
      > Martin Speight.
      >
      >[/color]


      Comment

      • Andrew Urquhart

        #4
        Re: Request.Form() - Return Value &amp; Strings

        *Martin Honnen* wrote:[color=blue]
        > Martin Speight wrote:[color=green]
        >> In an ASP script Request.Form() returns a value fine. But I want to
        >> be able to chop the returned value up using substring. Having
        >> trouble getting the return into a String variable so I can do this.
        >> eg.
        >> var eDate;
        >> var sDD,sMM,sYYYY,s HH,sMI,sSS;
        >> eDate=Request.F orm("edate");[/color]
        >
        > Use
        > eDate = String(Request. Form("edate"))[/color]

        I tend to prefer:

        var eDate = Request.Form("e date");
        eDate = eDate.Count ? eDate.Item(1) : "";

        It returns a string argument, but also copes with missing POST data and
        multiple key values.

        Re:[color=blue]
        > eDate = String(Request. Form("edate"))[/color]

        Casting the form collection to a string where there are multiple values
        for the same key would return a CSV string "value1, value2, value3".
        Also, if the post data is missing the value the returned value is the
        string "undefined" - which can be mistaken for real input content!
        --
        Andrew Urquhart
        - Javascript FAQ: http://www.jibbering.com/faq/
        - Archive: http://groups.google.com/groups?grou...ang.javascript
        - Contact: http://andrewu.co.uk/contact/

        Comment

        Working...