can i pass data with input text instead of input hidden?

Discussion in 'ASP General' started by Walter, Sep 13, 2004.

  1. Walter

    Walter Guest

    Hi,

    The user has to type his name into input a input field (type = text).
    This name must be passed to another ASP file.

    I did this but nothing happened:
    <form id=ins method="post" onsubmit="return doit()">
    Type your name:<input id=txt1 type="text">
    <INPUT id=smt TYPE="submit">
    </form>
    ....
    function doit()
    {
    document.getElementById("ins").action="file2.asp"
    return true;
    }
    ....
    When the user types his name and clicks on the submit button, it goes to
    file2.asp but the request.form("txt1") is empty.
    Do i have to use "hidden" input type instead?

    Thanks
    Walter
    Walter, Sep 13, 2004
    #1
    1. Advertising

  2. Walter

    John Guest

    Type your name:<input name=txt1 type="text">
    John, Sep 13, 2004
    #2
    1. Advertising

  3. You need to give form elements a NAME attribute for the server to be able to
    find them.

    Ray at work

    "Walter" <> wrote in message
    news:u%...
    > Hi,
    >
    > The user has to type his name into input a input field (type = text).
    > This name must be passed to another ASP file.
    >
    > I did this but nothing happened:
    > <form id=ins method="post" onsubmit="return doit()">
    > Type your name:<input id=txt1 type="text">
    > <INPUT id=smt TYPE="submit">
    > </form>
    > ...
    > function doit()
    > {
    > document.getElementById("ins").action="file2.asp"
    > return true;
    > }
    > ...
    > When the user types his name and clicks on the submit button, it goes to
    > file2.asp but the request.form("txt1") is empty.
    > Do i have to use "hidden" input type instead?
    >
    > Thanks
    > Walter
    >
    >
    Ray Costanzo [MVP], Sep 13, 2004
    #3
  4. Walter

    Evertjan. Guest

    Walter wrote on 13 sep 2004 in microsoft.public.inetserver.asp.general:

    > The user has to type his name into input a input field (type = text).
    > This name must be passed to another ASP file.
    >
    > I did this but nothing happened:


    > <input id=txt1 type="text">


    <input name="txt1">

    In fact not a ASP but a clietside bug, so OT.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress,
    but let us keep the discussions in the newsgroup)
    Evertjan., Sep 13, 2004
    #4
  5. Walter

    Walter Guest

    Thanks to all


    "Evertjan." <> wrote in message
    news:Xns9563AAD0D6E17eejj99@194.109.133.29...
    > Walter wrote on 13 sep 2004 in microsoft.public.inetserver.asp.general:
    >
    > > The user has to type his name into input a input field (type = text).
    > > This name must be passed to another ASP file.
    > >
    > > I did this but nothing happened:

    >
    > > <input id=txt1 type="text">

    >
    > <input name="txt1">
    >
    > In fact not a ASP but a clietside bug, so OT.
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress,
    > but let us keep the discussions in the newsgroup)
    >
    Walter, Sep 13, 2004
    #5
  6. Walter

    SimonFx Guest

    Can I just ask why don't you do:
    <form id=ins method="post" ACTION="file2.asp">
    Is this to force compatibility with a particular browser-only
    environment? Does using javascript add some extra flexibility or power?
    Or is it just the way some Microsoft tool automatically generates forms?

    Just curious.

    - Simon

    Walter wrote:
    > Hi,
    >
    > The user has to type his name into input a input field (type = text).
    > This name must be passed to another ASP file.
    >
    > I did this but nothing happened:
    > <form id=ins method="post" onsubmit="return doit()">
    > Type your name:<input id=txt1 type="text">
    > <INPUT id=smt TYPE="submit">
    > </form>
    > ...
    > function doit()
    > {
    > document.getElementById("ins").action="file2.asp"
    > return true;
    > }
    > ...
    > When the user types his name and clicks on the submit button, it goes to
    > file2.asp but the request.form("txt1") is empty.
    > Do i have to use "hidden" input type instead?
    >
    > Thanks
    > Walter
    >
    >
    SimonFx, Sep 17, 2004
    #6
  7. He's probably trying to control which page gets submitted to depending on
    which button on the form gets pressed.

    Bob Barrows
    SimonFx wrote:
    > Can I just ask why don't you do:
    > <form id=ins method="post" ACTION="file2.asp">
    > Is this to force compatibility with a particular browser-only
    > environment? Does using javascript add some extra flexibility or
    > power? Or is it just the way some Microsoft tool automatically
    > generates forms?
    > Just curious.
    >
    > - Simon
    >
    > Walter wrote:
    >> Hi,
    >>
    >> The user has to type his name into input a input field (type =
    >> text). This name must be passed to another ASP file.
    >>
    >> I did this but nothing happened:
    >> <form id=ins method="post" onsubmit="return doit()">
    >> Type your name:<input id=txt1 type="text">
    >> <INPUT id=smt TYPE="submit">
    >> </form>
    >> ...
    >> function doit()
    >> {
    >> document.getElementById("ins").action="file2.asp"
    >> return true;
    >> }
    >> ...
    >> When the user types his name and clicks on the submit button, it
    >> goes to file2.asp but the request.form("txt1") is empty.
    >> Do i have to use "hidden" input type instead?
    >>
    >> Thanks
    >> Walter


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Sep 17, 2004
    #7
    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. Mr A
    Replies:
    111
    Views:
    2,109
  2. Steve Kershaw
    Replies:
    3
    Views:
    1,019
    Eliyahu Goldin
    May 16, 2007
  3. jason
    Replies:
    6
    Views:
    376
    jason
    Nov 20, 2003
  4. SolarCanine
    Replies:
    2
    Views:
    275
    SolarCanine
    Sep 20, 2005
  5. Replies:
    3
    Views:
    159
    OmegaJunior
    Mar 11, 2007
Loading...

Share This Page