Passing a selected value to a form

Discussion in 'ASP General' started by TNGgroup, Nov 24, 2004.

  1. TNGgroup

    TNGgroup Guest

    Hi,

    Question, I have a simple form and want to submit a selected value of a
    combo box.
    so my combo box is named "selectname" and my form has action="file.asp?"
    what do I have to put after the question mark ?

    Thx in advance

    Wim
     
    TNGgroup, Nov 24, 2004
    #1
    1. Advertising

  2. TNGgroup wrote:
    > Hi,
    >
    > Question, I have a simple form and want to submit a selected value of
    > a combo box.
    > so my combo box is named "selectname" and my form has
    > action="file.asp?" what do I have to put after the question mark ?
    >
    > Thx in advance
    >
    > Wim

    Nothing. Get rid of the "?". Depending on the method attribute of your form
    element, your select element's value (there is no such thing as a combobox
    in html) will be passed without your doing a thing. If you use "GET", the
    form values will be automatically appended to the url's querystring. If you
    use "POST", the values will be passed in the Form collection. Go to
    msdn.microsoft.com/library and look up Request object, Form element, and
    Method attribute.

    Bob Barrows
    --
    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], Nov 24, 2004
    #2
    1. Advertising

  3. TNGgroup

    TNGgroup Guest

    Hi,

    When I post my form, (change the form attribute into get) and in the action
    specify the file which opens, I receive all my records, but what I need is
    the only the record which I selected in the list box

    I tried to look to the MS Site, but did not help a lot.

    TNG

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > TNGgroup wrote:
    > > Hi,
    > >
    > > Question, I have a simple form and want to submit a selected value of
    > > a combo box.
    > > so my combo box is named "selectname" and my form has
    > > action="file.asp?" what do I have to put after the question mark ?
    > >
    > > Thx in advance
    > >
    > > Wim

    > Nothing. Get rid of the "?". Depending on the method attribute of your

    form
    > element, your select element's value (there is no such thing as a combobox
    > in html) will be passed without your doing a thing. If you use "GET", the
    > form values will be automatically appended to the url's querystring. If

    you
    > use "POST", the values will be passed in the Form collection. Go to
    > msdn.microsoft.com/library and look up Request object, Form element, and
    > Method attribute.
    >
    > Bob Barrows
    > --
    > 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"
    >
    >
     
    TNGgroup, Nov 24, 2004
    #3
  4. How can we help? You're not showing us what you are doing. Create a small
    page (or two) that reproduces your problem and post that.

    Bob Barrows

    TNGgroup wrote:
    > Hi,
    >
    > When I post my form, (change the form attribute into get) and in the
    > action specify the file which opens, I receive all my records, but
    > what I need is the only the record which I selected in the list box
    >
    > I tried to look to the MS Site, but did not help a lot.
    >
    > TNG
    >
    > "Bob Barrows [MVP]" <> wrote in message
    > news:...
    >> TNGgroup wrote:
    >>> Hi,
    >>>
    >>> Question, I have a simple form and want to submit a selected value
    >>> of a combo box.
    >>> so my combo box is named "selectname" and my form has
    >>> action="file.asp?" what do I have to put after the question mark ?
    >>>
    >>> Thx in advance
    >>>
    >>> Wim

    >> Nothing. Get rid of the "?". Depending on the method attribute of
    >> your form element, your select element's value (there is no such
    >> thing as a combobox in html) will be passed without your doing a
    >> thing. If you use "GET", the form values will be automatically
    >> appended to the url's querystring. If you use "POST", the values
    >> will be passed in the Form collection. Go to
    >> msdn.microsoft.com/library and look up Request object, Form element,
    >> and Method attribute.
    >>
    >> Bob Barrows
    >> --
    >> 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"


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Nov 24, 2004
    #4
  5. TNGgroup

    Alex Goodey Guest

    When you submit a form, all elements in the form are passed to the "action"
    page.

    In your action page simply use.

    Request.QueryString("selectname")

    "TNGgroup" <> wrote in message
    news:41a489dd$0$7823$...
    > Hi,
    >
    > When I post my form, (change the form attribute into get) and in the

    action
    > specify the file which opens, I receive all my records, but what I need is
    > the only the record which I selected in the list box
    >
    > I tried to look to the MS Site, but did not help a lot.
    >
    > TNG
    >
    > "Bob Barrows [MVP]" <> wrote in message
    > news:...
    > > TNGgroup wrote:
    > > > Hi,
    > > >
    > > > Question, I have a simple form and want to submit a selected value of
    > > > a combo box.
    > > > so my combo box is named "selectname" and my form has
    > > > action="file.asp?" what do I have to put after the question mark ?
    > > >
    > > > Thx in advance
    > > >
    > > > Wim

    > > Nothing. Get rid of the "?". Depending on the method attribute of your

    > form
    > > element, your select element's value (there is no such thing as a

    combobox
    > > in html) will be passed without your doing a thing. If you use "GET",

    the
    > > form values will be automatically appended to the url's querystring. If

    > you
    > > use "POST", the values will be passed in the Form collection. Go to
    > > msdn.microsoft.com/library and look up Request object, Form element, and
    > > Method attribute.
    > >
    > > Bob Barrows
    > > --
    > > 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"
    > >
    > >

    >
    >
     
    Alex Goodey, Nov 24, 2004
    #5
  6. TNGgroup

    TNGgroup Guest

    Yes ! that was what I'm looking for Great

    Thx


    "Alex Goodey" <> wrote in message
    news:...
    > When you submit a form, all elements in the form are passed to the

    "action"
    > page.
    >
    > In your action page simply use.
    >
    > Request.QueryString("selectname")
    >
    > "TNGgroup" <> wrote in message
    > news:41a489dd$0$7823$...
    > > Hi,
    > >
    > > When I post my form, (change the form attribute into get) and in the

    > action
    > > specify the file which opens, I receive all my records, but what I need

    is
    > > the only the record which I selected in the list box
    > >
    > > I tried to look to the MS Site, but did not help a lot.
    > >
    > > TNG
    > >
    > > "Bob Barrows [MVP]" <> wrote in message
    > > news:...
    > > > TNGgroup wrote:
    > > > > Hi,
    > > > >
    > > > > Question, I have a simple form and want to submit a selected value

    of
    > > > > a combo box.
    > > > > so my combo box is named "selectname" and my form has
    > > > > action="file.asp?" what do I have to put after the question mark ?
    > > > >
    > > > > Thx in advance
    > > > >
    > > > > Wim
    > > > Nothing. Get rid of the "?". Depending on the method attribute of your

    > > form
    > > > element, your select element's value (there is no such thing as a

    > combobox
    > > > in html) will be passed without your doing a thing. If you use "GET",

    > the
    > > > form values will be automatically appended to the url's querystring.

    If
    > > you
    > > > use "POST", the values will be passed in the Form collection. Go to
    > > > msdn.microsoft.com/library and look up Request object, Form element,

    and
    > > > Method attribute.
    > > >
    > > > Bob Barrows
    > > > --
    > > > 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"
    > > >
    > > >

    > >
    > >

    >
    >
     
    TNGgroup, Nov 24, 2004
    #6
  7. TNGgroup

    TNGgroup Guest

    Solution works as said before, but a small additional question, how can I
    solve 2 forms pointing to the same page ?

    "Alex Goodey" <> wrote in message
    news:...
    > When you submit a form, all elements in the form are passed to the

    "action"
    > page.
    >
    > In your action page simply use.
    >
    > Request.QueryString("selectname")
    >
    > "TNGgroup" <> wrote in message
    > news:41a489dd$0$7823$...
    > > Hi,
    > >
    > > When I post my form, (change the form attribute into get) and in the

    > action
    > > specify the file which opens, I receive all my records, but what I need

    is
    > > the only the record which I selected in the list box
    > >
    > > I tried to look to the MS Site, but did not help a lot.
    > >
    > > TNG
    > >
    > > "Bob Barrows [MVP]" <> wrote in message
    > > news:...
    > > > TNGgroup wrote:
    > > > > Hi,
    > > > >
    > > > > Question, I have a simple form and want to submit a selected value

    of
    > > > > a combo box.
    > > > > so my combo box is named "selectname" and my form has
    > > > > action="file.asp?" what do I have to put after the question mark ?
    > > > >
    > > > > Thx in advance
    > > > >
    > > > > Wim
    > > > Nothing. Get rid of the "?". Depending on the method attribute of your

    > > form
    > > > element, your select element's value (there is no such thing as a

    > combobox
    > > > in html) will be passed without your doing a thing. If you use "GET",

    > the
    > > > form values will be automatically appended to the url's querystring.

    If
    > > you
    > > > use "POST", the values will be passed in the Form collection. Go to
    > > > msdn.microsoft.com/library and look up Request object, Form element,

    and
    > > > Method attribute.
    > > >
    > > > Bob Barrows
    > > > --
    > > > 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"
    > > >
    > > >

    > >
    > >

    >
    >
     
    TNGgroup, Nov 24, 2004
    #7
  8. TNGgroup

    Alex Goodey Guest

    You will have to provide some more information about what you are trying to
    do.

    Are both forms on the same page?

    only one form can be submitted at any one time.

    "TNGgroup" <> wrote in message
    news:41a4a809$0$25057$...
    > Solution works as said before, but a small additional question, how can I
    > solve 2 forms pointing to the same page ?
    >
    > "Alex Goodey" <> wrote in message
    > news:...
    > > When you submit a form, all elements in the form are passed to the

    > "action"
    > > page.
    > >
    > > In your action page simply use.
    > >
    > > Request.QueryString("selectname")
    > >
    > > "TNGgroup" <> wrote in message
    > > news:41a489dd$0$7823$...
    > > > Hi,
    > > >
    > > > When I post my form, (change the form attribute into get) and in the

    > > action
    > > > specify the file which opens, I receive all my records, but what I

    need
    > is
    > > > the only the record which I selected in the list box
    > > >
    > > > I tried to look to the MS Site, but did not help a lot.
    > > >
    > > > TNG
    > > >
    > > > "Bob Barrows [MVP]" <> wrote in message
    > > > news:...
    > > > > TNGgroup wrote:
    > > > > > Hi,
    > > > > >
    > > > > > Question, I have a simple form and want to submit a selected value

    > of
    > > > > > a combo box.
    > > > > > so my combo box is named "selectname" and my form has
    > > > > > action="file.asp?" what do I have to put after the question mark ?
    > > > > >
    > > > > > Thx in advance
    > > > > >
    > > > > > Wim
    > > > > Nothing. Get rid of the "?". Depending on the method attribute of

    your
    > > > form
    > > > > element, your select element's value (there is no such thing as a

    > > combobox
    > > > > in html) will be passed without your doing a thing. If you use

    "GET",
    > > the
    > > > > form values will be automatically appended to the url's querystring.

    > If
    > > > you
    > > > > use "POST", the values will be passed in the Form collection. Go to
    > > > > msdn.microsoft.com/library and look up Request object, Form element,

    > and
    > > > > Method attribute.
    > > > >
    > > > > Bob Barrows
    > > > > --
    > > > > 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"
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Alex Goodey, Nov 24, 2004
    #8
  9. TNGgroup

    TNGgroup Guest

    Ok, indeed both forms are on the same page, so like you said if only one
    form can be submitted. I have to change my structure.

    Thx anyway

    "Alex Goodey" <> wrote in message
    news:...
    > You will have to provide some more information about what you are trying

    to
    > do.
    >
    > Are both forms on the same page?
    >
    > only one form can be submitted at any one time.
    >
    > "TNGgroup" <> wrote in message
    > news:41a4a809$0$25057$...
    > > Solution works as said before, but a small additional question, how can

    I
    > > solve 2 forms pointing to the same page ?
    > >
    > > "Alex Goodey" <> wrote in message
    > > news:...
    > > > When you submit a form, all elements in the form are passed to the

    > > "action"
    > > > page.
    > > >
    > > > In your action page simply use.
    > > >
    > > > Request.QueryString("selectname")
    > > >
    > > > "TNGgroup" <> wrote in message
    > > > news:41a489dd$0$7823$...
    > > > > Hi,
    > > > >
    > > > > When I post my form, (change the form attribute into get) and in the
    > > > action
    > > > > specify the file which opens, I receive all my records, but what I

    > need
    > > is
    > > > > the only the record which I selected in the list box
    > > > >
    > > > > I tried to look to the MS Site, but did not help a lot.
    > > > >
    > > > > TNG
    > > > >
    > > > > "Bob Barrows [MVP]" <> wrote in message
    > > > > news:...
    > > > > > TNGgroup wrote:
    > > > > > > Hi,
    > > > > > >
    > > > > > > Question, I have a simple form and want to submit a selected

    value
    > > of
    > > > > > > a combo box.
    > > > > > > so my combo box is named "selectname" and my form has
    > > > > > > action="file.asp?" what do I have to put after the question mark

    ?
    > > > > > >
    > > > > > > Thx in advance
    > > > > > >
    > > > > > > Wim
    > > > > > Nothing. Get rid of the "?". Depending on the method attribute of

    > your
    > > > > form
    > > > > > element, your select element's value (there is no such thing as a
    > > > combobox
    > > > > > in html) will be passed without your doing a thing. If you use

    > "GET",
    > > > the
    > > > > > form values will be automatically appended to the url's

    querystring.
    > > If
    > > > > you
    > > > > > use "POST", the values will be passed in the Form collection. Go

    to
    > > > > > msdn.microsoft.com/library and look up Request object, Form

    element,
    > > and
    > > > > > Method attribute.
    > > > > >
    > > > > > Bob Barrows
    > > > > > --
    > > > > > 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"
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    TNGgroup, Nov 24, 2004
    #9
    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. Iceman
    Replies:
    1
    Views:
    437
    Steve Pugh
    Jan 7, 2004
  2. Iain
    Replies:
    3
    Views:
    937
  3. Nathan Sokalski
    Replies:
    0
    Views:
    613
    Nathan Sokalski
    Oct 5, 2008
  4. jonefer

    passing a gridview selected value

    jonefer, Apr 18, 2008, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    1,269
    Jacques MUREKEZI
    Jul 8, 2008
  5. maflu
    Replies:
    1
    Views:
    264
Loading...

Share This Page