Request.QueryString() and/or Request.Form()

Discussion in 'ASP .Net' started by George, Apr 1, 2004.

  1. George

    George Guest

    VS.NET 2002/VB

    Is it possible to retrieve HTML form variables that are hidden input types using
    Request.QueryString() and/or Request.Form()?

    I have tried various ways of using those, but to no avail. My HTML form method is set to POST, and I
    thought I had read somewhere that this could be done.

    If it is not possible, is there any way to retrieve HTML form variables into my .aspx page?

    Thanks,
    George
     
    George, Apr 1, 2004
    #1
    1. Advertising

  2. George

    Marina Guest

    Request.QueryString is only for parameters passed in the URL.

    Request.Form works very nicely for retrieving posted hidden controls.

    "George" <------@----.---> wrote in message
    news:QC0bc.9809$...
    > VS.NET 2002/VB
    >
    > Is it possible to retrieve HTML form variables that are hidden input types

    using
    > Request.QueryString() and/or Request.Form()?
    >
    > I have tried various ways of using those, but to no avail. My HTML form

    method is set to POST, and I
    > thought I had read somewhere that this could be done.
    >
    > If it is not possible, is there any way to retrieve HTML form variables

    into my .aspx page?
    >
    > Thanks,
    > George
    >
    >
    >
     
    Marina, Apr 1, 2004
    #2
    1. Advertising

  3. George

    George Guest

    Marina,

    Actually, I didn't really explain my problem very well.

    I have an .htm page that uses an HTML form button to open my .aspx page in a new window without any
    buttons on it. That may be why I can't retrieve my hidden inputs in the HTML form, because, even
    though the method is set to POST, the action is set to call a javascript function that uses
    window.open() to open my .aspx page in the new window, instead of the action being set to call the
    ..aspx page directly.

    I am not certain, but is it possible to retrieve those hidden inputs like that? If not, is there
    anyway of doing it?

    Thanks,
    George


    "Marina" <> wrote in message news:...
    > Request.QueryString is only for parameters passed in the URL.
    >
    > Request.Form works very nicely for retrieving posted hidden controls.
    >
    > "George" <------@----.---> wrote in message
    > news:QC0bc.9809$...
    > > VS.NET 2002/VB
    > >
    > > Is it possible to retrieve HTML form variables that are hidden input types

    > using
    > > Request.QueryString() and/or Request.Form()?
    > >
    > > I have tried various ways of using those, but to no avail. My HTML form

    > method is set to POST, and I
    > > thought I had read somewhere that this could be done.
    > >
    > > If it is not possible, is there any way to retrieve HTML form variables

    > into my .aspx page?
    > >
    > > Thanks,
    > > George
    > >
    > >
    > >

    >
    >
     
    George, Apr 2, 2004
    #3
  4. You can certainly retrieve posted form values from the Request.Form
    Collection. It should be noted that this Collection is keyed by the "name"
    attribute of the form fields, not the id.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "George" <------@----.---> wrote in message
    news:QC0bc.9809$...
    > VS.NET 2002/VB
    >
    > Is it possible to retrieve HTML form variables that are hidden input types

    using
    > Request.QueryString() and/or Request.Form()?
    >
    > I have tried various ways of using those, but to no avail. My HTML form

    method is set to POST, and I
    > thought I had read somewhere that this could be done.
    >
    > If it is not possible, is there any way to retrieve HTML form variables

    into my .aspx page?
    >
    > Thanks,
    > George
    >
    >
    >
     
    Kevin Spencer, Apr 2, 2004
    #4
  5. Hi George,

    If I understand you correctly, you are using the JavaScript window.open()
    mthod to open a child window, and you want to retrieve some form values from
    the parent window in the child window? If that's the case, you should be
    aware that the only way for those 2 pages to "talk" is on the client, via
    JavaScript. On the server, the classes don't even exist at the same time.
    Only on the client are they concurrent and able to communicate. In the child
    window, you refer to the parent window as "opener." So, if you want to get
    the value of a form field in the parent with the name "foo" you could use
    something like the following:

    <script type="text/javascript"><!--
    var s = opener.document.forms[0].foo.value;
    // --></script>

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "George" <------@----.---> wrote in message
    news:ci1bc.9940$...
    > Marina,
    >
    > Actually, I didn't really explain my problem very well.
    >
    > I have an .htm page that uses an HTML form button to open my .aspx page in

    a new window without any
    > buttons on it. That may be why I can't retrieve my hidden inputs in the

    HTML form, because, even
    > though the method is set to POST, the action is set to call a javascript

    function that uses
    > window.open() to open my .aspx page in the new window, instead of the

    action being set to call the
    > .aspx page directly.
    >
    > I am not certain, but is it possible to retrieve those hidden inputs like

    that? If not, is there
    > anyway of doing it?
    >
    > Thanks,
    > George
    >
    >
    > "Marina" <> wrote in message

    news:...
    > > Request.QueryString is only for parameters passed in the URL.
    > >
    > > Request.Form works very nicely for retrieving posted hidden controls.
    > >
    > > "George" <------@----.---> wrote in message
    > > news:QC0bc.9809$...
    > > > VS.NET 2002/VB
    > > >
    > > > Is it possible to retrieve HTML form variables that are hidden input

    types
    > > using
    > > > Request.QueryString() and/or Request.Form()?
    > > >
    > > > I have tried various ways of using those, but to no avail. My HTML

    form
    > > method is set to POST, and I
    > > > thought I had read somewhere that this could be done.
    > > >
    > > > If it is not possible, is there any way to retrieve HTML form

    variables
    > > into my .aspx page?
    > > >
    > > > Thanks,
    > > > George
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Kevin Spencer, Apr 2, 2004
    #5
  6. George

    George Guest

    Kevin,

    Thanks for the suggestions and the lesson; it's always appreciated.

    George

    "Kevin Spencer" <> wrote in message news:%...
    > Hi George,
    >
    > If I understand you correctly, you are using the JavaScript window.open()
    > mthod to open a child window, and you want to retrieve some form values from
    > the parent window in the child window? If that's the case, you should be
    > aware that the only way for those 2 pages to "talk" is on the client, via
    > JavaScript. On the server, the classes don't even exist at the same time.
    > Only on the client are they concurrent and able to communicate. In the child
    > window, you refer to the parent window as "opener." So, if you want to get
    > the value of a form field in the parent with the name "foo" you could use
    > something like the following:
    >
    > <script type="text/javascript"><!--
    > var s = opener.document.forms[0].foo.value;
    > // --></script>
    >
    > --
    > HTH,
    > Kevin Spencer
    > .Net Developer
    > Microsoft MVP
    > Big things are made up
    > of lots of little things.
    >
    > "George" <------@----.---> wrote in message
    > news:ci1bc.9940$...
    > > Marina,
    > >
    > > Actually, I didn't really explain my problem very well.
    > >
    > > I have an .htm page that uses an HTML form button to open my .aspx page in

    > a new window without any
    > > buttons on it. That may be why I can't retrieve my hidden inputs in the

    > HTML form, because, even
    > > though the method is set to POST, the action is set to call a javascript

    > function that uses
    > > window.open() to open my .aspx page in the new window, instead of the

    > action being set to call the
    > > .aspx page directly.
    > >
    > > I am not certain, but is it possible to retrieve those hidden inputs like

    > that? If not, is there
    > > anyway of doing it?
    > >
    > > Thanks,
    > > George
    > >
    > >
    > > "Marina" <> wrote in message

    > news:...
    > > > Request.QueryString is only for parameters passed in the URL.
    > > >
    > > > Request.Form works very nicely for retrieving posted hidden controls.
    > > >
    > > > "George" <------@----.---> wrote in message
    > > > news:QC0bc.9809$...
    > > > > VS.NET 2002/VB
    > > > >
    > > > > Is it possible to retrieve HTML form variables that are hidden input

    > types
    > > > using
    > > > > Request.QueryString() and/or Request.Form()?
    > > > >
    > > > > I have tried various ways of using those, but to no avail. My HTML

    > form
    > > > method is set to POST, and I
    > > > > thought I had read somewhere that this could be done.
    > > > >
    > > > > If it is not possible, is there any way to retrieve HTML form

    > variables
    > > > into my .aspx page?
    > > > >
    > > > > Thanks,
    > > > > George
    > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    George, Apr 2, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Bass
    Replies:
    2
    Views:
    3,777
    dave wanta
    Jul 4, 2003
  2. Mehdi
    Replies:
    6
    Views:
    36,261
    sloan
    Apr 6, 2006
  3. michaaal
    Replies:
    6
    Views:
    438
    Michael D. Kersey
    Jul 15, 2003
  4. John Davis
    Replies:
    2
    Views:
    426
    Dave Anderson
    Aug 18, 2003
  5. Adeel Ahmad
    Replies:
    1
    Views:
    586
    Anthony Jones
    Mar 7, 2006
Loading...

Share This Page