Request.Form in Javascript

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

    Request.Form in Javascript

    Hi,

    Can I:

    <script language="javas cript">
    var TimeSec = new String (Request.form(" TimeInSec"));


    or

    <script language="javas cript">
    var TimeSec = new int(Request.for m("TimeInSec")) ;



    or

    <script language="javas cript">
    var TimeSec = Request.form("T imeInSec");



    All three seems not working. Any workaround ? Thanks.

    Regards,
    Magix



  • Martin Honnen

    #2
    Re: Request.Form in Javascript

    magix wrote:
    All three seems not working. Any workaround ? Thanks.
    What exactly are you trying to achieve? Do you want to use JScript on
    the server in classic ASP? Or JScript.NET with ASP.NET? Or something else?


    --

    Martin Honnen

    Comment

    • magix

      #3
      Re: Request.Form in Javascript

      For example, there are 2 files, file1.asp and file2.asp
      in File1.asp, i have
      <form name="abc" method="post" action="file2.a sp">

      loop through some Db table record, and assign the value, like
      <input type="hidden" name="QTimeInSe c" value="<%=QTime InSec%>">
      </form>
      after SUBMIT the form,
      in File2.asp, i need to assign the value of request.form("T imeInSec") to
      javascript variables for some further actions.
      So, just wonder on how to apply the usage of Request.Form in javascript.

      <script language="javas cript">
      var TimeSec = new string (request.form(" TimeInSec"));
      ...
      ...
      </script>



      "Martin Honnen" <mahotrash@yaho o.dewrote in message
      news:476d4424$0 $16671$9b4e6d93 @newsspool3.arc or-online.net...
      magix wrote:
      >
      >All three seems not working. Any workaround ? Thanks.
      >
      What exactly are you trying to achieve? Do you want to use JScript on the
      server in classic ASP? Or JScript.NET with ASP.NET? Or something else?
      >
      >
      --
      >
      Martin Honnen
      http://JavaScript.FAQTs.com/

      Comment

      • Martin Honnen

        #4
        Re: Request.Form in Javascript

        magix wrote:
        For example, there are 2 files, file1.asp and file2.asp
        in File1.asp, i have
        <form name="abc" method="post" action="file2.a sp">
        >
        loop through some Db table record, and assign the value, like
        <input type="hidden" name="QTimeInSe c" value="<%=QTime InSec%>">
        </form>
        after SUBMIT the form,
        in File2.asp, i need to assign the value of request.form("T imeInSec") to
        javascript variables for some further actions.
        So, just wonder on how to apply the usage of Request.Form in javascript.
        >
        <script language="javas cript">
        var TimeSec = new string (request.form(" TimeInSec"));
        ...
        ...
        </script>
        Do you want to use JScript on the server instead of VBScript? Or do you
        use VBScript in your ASP pages and want to pass values to client-side
        JavaScript?


        --

        Martin Honnen

        Comment

        • magix

          #5
          Re: Request.Form in Javascript

          I just want to pass the parameter value to javascript in another asp file.

          Question is how's the usage of Request.Form in javascript ? Or is it
          possible to use Request.Form in javascript

          Regards.

          "Martin Honnen" <mahotrash@yaho o.dewrote in message
          news:476d4fec$0 $13108$9b4e6d93 @newsspool2.arc or-online.net...
          magix wrote:
          >For example, there are 2 files, file1.asp and file2.asp
          >in File1.asp, i have
          > <form name="abc" method="post" action="file2.a sp">
          >>
          > loop through some Db table record, and assign the value, like
          > <input type="hidden" name="QTimeInSe c" value="<%=QTime InSec%>">
          ></form>
          >after SUBMIT the form,
          >in File2.asp, i need to assign the value of request.form("T imeInSec") to
          >javascript variables for some further actions.
          >So, just wonder on how to apply the usage of Request.Form in javascript.
          >>
          ><script language="javas cript">
          > var TimeSec = new string (request.form(" TimeInSec"));
          > ...
          > ...
          ></script>
          >
          Do you want to use JScript on the server instead of VBScript? Or do you
          use VBScript in your ASP pages and want to pass values to client-side
          JavaScript?
          >
          >
          --
          >
          Martin Honnen
          http://JavaScript.FAQTs.com/

          Comment

          • Evertjan.

            #6
            Re: Request.Form in Javascript

            magix wrote on 22 dec 2007 in comp.lang.javas cript:
            <script language="javas cript">
            var TimeSec = new string (request.form(" TimeInSec"));
            ...
            ...
            </script>
            >
            You are mixing serverside code,
            ASP-vbscript or ASP-j[ava]script,
            with clientside Javascript.

            That is imposible as the two interpreters run on seperate machines
            and not even at the same time.
            Serverside coding renders a stream of HTML [+ clientside scripts]
            that are sent to the client, read browser.

            ASP Request.form() returns a string if it exists.


            So try this:

            <script language="javas cript">
            var s = '<% = request.form("v 1") %>'; // posting a string
            var n = <% = request.form("v 2") %>; // posting a number
            </script>

            The string should not contain '-s

            --
            Evertjan.
            The Netherlands.
            (Please change the x'es to dots in my emailaddress)

            Comment

            • magix

              #7
              Re: Request.Form in Javascript

              Thanks Evertjan. This works well.
              "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
              news:Xns9A0EC24 27CA62eejj99@19 4.109.133.242.. .
              magix wrote on 22 dec 2007 in comp.lang.javas cript:
              >
              ><script language="javas cript">
              > var TimeSec = new string (request.form(" TimeInSec"));
              > ...
              > ...
              ></script>
              >>
              >
              You are mixing serverside code,
              ASP-vbscript or ASP-j[ava]script,
              with clientside Javascript.
              >
              That is imposible as the two interpreters run on seperate machines
              and not even at the same time.
              Serverside coding renders a stream of HTML [+ clientside scripts]
              that are sent to the client, read browser.
              >
              ASP Request.form() returns a string if it exists.
              >
              >
              So try this:
              >
              <script language="javas cript">
              var s = '<% = request.form("v 1") %>'; // posting a string
              var n = <% = request.form("v 2") %>; // posting a number
              </script>
              >
              The string should not contain '-s
              >
              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              Working...