dynamic form values

Discussion in 'ASP General' started by Dave Karmens, Feb 26, 2004.

  1. Dave Karmens

    Dave Karmens Guest

    If I have say 10 fixed variables, how can I set their values = to that
    of a form that is built dynamically?

    column1 column2
    email = formvalue(0)
    fname = formvalue(1)
    lname = formvalue(2)

    etc..

    lastvar = formvalue(9)
    Dave Karmens, Feb 26, 2004
    #1
    1. Advertising

  2. Dave Karmens

    Ray at Guest

    What do you mean? <input type="text" value="<%=variableName%>">

    Ray at work

    "Dave Karmens" <> wrote in message
    news:%23MaQ2JL$...
    > If I have say 10 fixed variables, how can I set their values = to that
    > of a form that is built dynamically?
    >
    > column1 column2
    > email = formvalue(0)
    > fname = formvalue(1)
    > lname = formvalue(2)
    >
    > etc..
    >
    > lastvar = formvalue(9)
    Ray at, Feb 26, 2004
    #2
    1. Advertising

  3. Dave Karmens

    Dave Karmens Guest

    No, I would need to loop though the values of a drop down list and
    assign value1 to email, value2 to fname...

    Ray at <%=sLocation%> [MVP] wrote:

    > What do you mean? <input type="text" value="<%=variableName%>">
    >
    > Ray at work
    >
    > "Dave Karmens" <> wrote in message
    > news:%23MaQ2JL$...
    >
    >>If I have say 10 fixed variables, how can I set their values = to that
    >>of a form that is built dynamically?
    >>
    >>column1 column2
    >>email = formvalue(0)
    >>fname = formvalue(1)
    >>lname = formvalue(2)
    >>
    >>etc..
    >>
    >>lastvar = formvalue(9)

    >
    >
    >
    Dave Karmens, Feb 26, 2004
    #3
  4. Dave Karmens

    Ray at Guest

    When, when the page is submitted? When it is loaded? Can you explain this
    in a little more detail?

    Ray at work

    "Dave Karmens" <> wrote in message
    news:%23FJWoTL$...
    > No, I would need to loop though the values of a drop down list and
    > assign value1 to email, value2 to fname...
    >
    > Ray at <%=sLocation%> [MVP] wrote:
    >
    > > What do you mean? <input type="text" value="<%=variableName%>">
    > >
    > > Ray at work
    > >
    > > "Dave Karmens" <> wrote in message
    > > news:%23MaQ2JL$...
    > >
    > >>If I have say 10 fixed variables, how can I set their values = to that
    > >>of a form that is built dynamically?
    > >>
    > >>column1 column2
    > >>email = formvalue(0)
    > >>fname = formvalue(1)
    > >>lname = formvalue(2)
    > >>
    > >>etc..
    > >>
    > >>lastvar = formvalue(9)

    > >
    > >
    > >
    Ray at, Feb 26, 2004
    #4
  5. > No, I would need to loop though the values of a drop down list and
    > assign value1 to email, value2 to fname...


    When you have a drop-down box only the selected item is submitted with the
    form, the non-selected values are "lost"
    Adrian Forbes [ASP MVP], Feb 26, 2004
    #5
  6. Dave Karmens

    Dave Karmens Guest

    A user will fill out the dropdown list and hit submit - a form will then
    map the constants to the form values to build a SQL string that will
    be passed to a stored procedure.

    Ray at <%=sLocation%> [MVP] wrote:

    > When, when the page is submitted? When it is loaded? Can you explain this
    > in a little more detail?
    >
    > Ray at work
    >
    > "Dave Karmens" <> wrote in message
    > news:%23FJWoTL$...
    >
    >>No, I would need to loop though the values of a drop down list and
    >>assign value1 to email, value2 to fname...
    >>
    >>Ray at <%=sLocation%> [MVP] wrote:
    >>
    >>
    >>>What do you mean? <input type="text" value="<%=variableName%>">
    >>>
    >>>Ray at work
    >>>
    >>>"Dave Karmens" <> wrote in message
    >>>news:%23MaQ2JL$...
    >>>
    >>>
    >>>>If I have say 10 fixed variables, how can I set their values = to that
    >>>>of a form that is built dynamically?
    >>>>
    >>>>column1 column2
    >>>>email = formvalue(0)
    >>>>fname = formvalue(1)
    >>>>lname = formvalue(2)
    >>>>
    >>>>etc..
    >>>>
    >>>>lastvar = formvalue(9)
    >>>
    >>>
    >>>

    >
    >
    Dave Karmens, Feb 26, 2004
    #6
  7. Dave Karmens

    Dave Karmens Guest

    Yes, I don't want the non-selected values.

    The form is built dynamically from an uploaded .csv -- the first line of
    the .csv is loaded into a drop down list. There is another, static list
    that matches up with those values.

    Adrian Forbes [ASP MVP] wrote:

    >>No, I would need to loop though the values of a drop down list and
    >>assign value1 to email, value2 to fname...

    >
    >
    > When you have a drop-down box only the selected item is submitted with the
    > form, the non-selected values are "lost"
    >
    >
    Dave Karmens, Feb 26, 2004
    #7
  8. Dave Karmens

    Ray at Guest

    So, you'll have an unknown number of values to assign to an unknown number
    of variables? What about putting them in an array? If I fill out your
    form, and I enter these terms in your select box:

    cat
    bird
    ferret

    what is the ultimate goal as far as what your SQL string will look like?

    Ray at home

    "Dave Karmens" <> wrote in message
    news:eqMXBmL$...
    > A user will fill out the dropdown list and hit submit - a form will then
    > map the constants to the form values to build a SQL string that will
    > be passed to a stored procedure.
    >
    > Ray at <%=sLocation%> [MVP] wrote:
    >
    > > When, when the page is submitted? When it is loaded? Can you explain

    this
    > > in a little more detail?
    > >
    > > Ray at work
    > >
    > > "Dave Karmens" <> wrote in message
    > > news:%23FJWoTL$...
    > >
    > >>No, I would need to loop though the values of a drop down list and
    > >>assign value1 to email, value2 to fname...
    > >>
    > >>Ray at <%=sLocation%> [MVP] wrote:
    > >>
    > >>
    > >>>What do you mean? <input type="text" value="<%=variableName%>">
    > >>>
    > >>>Ray at work
    > >>>
    > >>>"Dave Karmens" <> wrote in message
    > >>>news:%23MaQ2JL$...
    > >>>
    > >>>
    > >>>>If I have say 10 fixed variables, how can I set their values = to that
    > >>>>of a form that is built dynamically?
    > >>>>
    > >>>>column1 column2
    > >>>>email = formvalue(0)
    > >>>>fname = formvalue(1)
    > >>>>lname = formvalue(2)
    > >>>>
    > >>>>etc..
    > >>>>
    > >>>>lastvar = formvalue(9)
    > >>>
    > >>>
    > >>>

    > >
    > >
    Ray at, Feb 26, 2004
    #8
  9. Dave Karmens

    Dave Karmens Guest

    Hey Ray, thanks for sticking in...

    I'll have an unknown number of values loaded from the .CSV, but no more
    than 10. There will also be a fixed number of variables to assign them
    to. If there is only 7 loaded the rest will be set to "".

    The .csv might have user user_email, first_name, last_name so they would
    map those to the fixed values email, fname, lname.

    The SQL string is a very simple insert:

    insert into tbl_test (email, fname, lname)
    values ('"&user_email&"','"&first_name&"','"&last_name&"')


    This is the basic idea:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <table width="300">
    <tr>
    <td>Fixed List</td>
    <td>CSV List</td>
    </tr>
    <tr>
    <td>Email</td>
    <td><select name="flds">
    <option name="none" value="none">none</option>
    <option name="user_email" value="user_email">user_email</option>
    <option name="user_fname" value="user_fname">user_fname</option>
    <option name="user_lname" value="user_lname">user_lname</option>
    </select></td>
    </tr>
    <tr>
    <td>First Name</td>
    <td><select name="flds">
    <option name="none" value="none">none</option>
    <option name="user_email" value="user_email">user_email</option>
    <option name="user_fname" value="user_fname">user_fname</option>
    <option name="user_lname" value="user_lname">user_lname</option>
    </select></td>
    </tr>
    <tr>
    <td>Last Name</td>
    <td><select name="flds">
    <option name="none" value="none">none</option>
    <option name="user_email" value="user_email">user_email</option>
    <option name="user_fname" value="user_fname">user_fname</option>
    <option name="user_lname" value="user_lname">user_lname</option>
    </select></td>
    </tr>
    </table>
    </body>
    </html>

    Ray at <%=sLocation%> [MVP] wrote:
    > So, you'll have an unknown number of values to assign to an unknown number
    > of variables? What about putting them in an array? If I fill out your
    > form, and I enter these terms in your select box:
    >
    > cat
    > bird
    > ferret
    >
    > what is the ultimate goal as far as what your SQL string will look like?
    >
    > Ray at home
    >
    > "Dave Karmens" <> wrote in message
    > news:eqMXBmL$...
    >
    >>A user will fill out the dropdown list and hit submit - a form will then
    >> map the constants to the form values to build a SQL string that will
    >>be passed to a stored procedure.
    >>
    >>Ray at <%=sLocation%> [MVP] wrote:
    >>
    >>
    >>>When, when the page is submitted? When it is loaded? Can you explain

    >
    > this
    >
    >>>in a little more detail?
    >>>
    >>>Ray at work
    >>>
    >>>"Dave Karmens" <> wrote in message
    >>>news:%23FJWoTL$...
    >>>
    >>>
    >>>>No, I would need to loop though the values of a drop down list and
    >>>>assign value1 to email, value2 to fname...
    >>>>
    >>>>Ray at <%=sLocation%> [MVP] wrote:
    >>>>
    >>>>
    >>>>
    >>>>>What do you mean? <input type="text" value="<%=variableName%>">
    >>>>>
    >>>>>Ray at work
    >>>>>
    >>>>>"Dave Karmens" <> wrote in message
    >>>>>news:%23MaQ2JL$...
    >>>>>
    >>>>>
    >>>>>
    >>>>>>If I have say 10 fixed variables, how can I set their values = to that
    >>>>>>of a form that is built dynamically?
    >>>>>>
    >>>>>>column1 column2
    >>>>>>email = formvalue(0)
    >>>>>>fname = formvalue(1)
    >>>>>>lname = formvalue(2)
    >>>>>>
    >>>>>>etc..
    >>>>>>
    >>>>>>lastvar = formvalue(9)
    >>>>>
    >>>>>
    >>>>>
    >>>

    >
    >
    Dave Karmens, Feb 27, 2004
    #9
  10. Dave Karmens

    Ray at Guest

    In that case, split your select value and assign the values to your
    variables, like:

    On Error Resume Next
    firstvar = Request.Form("select")(1)
    secondvar = Request.Form("select")(2)
    thirdvar = Request.Form("select")(3)
    fourthvar = Request.Form("select")(4)
    fifthvar = Request.Form("select")(5)
    sixthvar = Request.Form("select")(6)
    seventhvar = Request.Form("select")(7)
    eighthvar = Request.Form("select")(8)
    ninthvar = Request.Form("select")(9)
    tenthvar = Request.Form("select")(10)
    On Error Goto 0

    Ray at work




    "Dave Karmens" <> wrote in message
    news:Oze$HtT$...
    > Hey Ray, thanks for sticking in...
    >
    > I'll have an unknown number of values loaded from the .CSV, but no more
    > than 10. There will also be a fixed number of variables to assign them
    > to. If there is only 7 loaded the rest will be set to "".
    >
    > The .csv might have user user_email, first_name, last_name so they would
    > map those to the fixed values email, fname, lname.
    >
    > The SQL string is a very simple insert:
    >
    > insert into tbl_test (email, fname, lname)
    > values ('"&user_email&"','"&first_name&"','"&last_name&"')
    >
    >
    > This is the basic idea:
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    > <html>
    > <head>
    > <title>Untitled Document</title>
    > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    > </head>
    > <body>
    > <table width="300">
    > <tr>
    > <td>Fixed List</td>
    > <td>CSV List</td>
    > </tr>
    > <tr>
    > <td>Email</td>
    > <td><select name="flds">
    > <option name="none" value="none">none</option>
    > <option name="user_email" value="user_email">user_email</option>
    > <option name="user_fname" value="user_fname">user_fname</option>
    > <option name="user_lname" value="user_lname">user_lname</option>
    > </select></td>
    > </tr>
    > <tr>
    > <td>First Name</td>
    > <td><select name="flds">
    > <option name="none" value="none">none</option>
    > <option name="user_email" value="user_email">user_email</option>
    > <option name="user_fname" value="user_fname">user_fname</option>
    > <option name="user_lname" value="user_lname">user_lname</option>
    > </select></td>
    > </tr>
    > <tr>
    > <td>Last Name</td>
    > <td><select name="flds">
    > <option name="none" value="none">none</option>
    > <option name="user_email" value="user_email">user_email</option>
    > <option name="user_fname" value="user_fname">user_fname</option>
    > <option name="user_lname" value="user_lname">user_lname</option>
    > </select></td>
    > </tr>
    > </table>
    > </body>
    > </html>
    >
    > Ray at <%=sLocation%> [MVP] wrote:
    > > So, you'll have an unknown number of values to assign to an unknown

    number
    > > of variables? What about putting them in an array? If I fill out your
    > > form, and I enter these terms in your select box:
    > >
    > > cat
    > > bird
    > > ferret
    > >
    > > what is the ultimate goal as far as what your SQL string will look like?
    > >
    > > Ray at home
    > >
    > > "Dave Karmens" <> wrote in message
    > > news:eqMXBmL$...
    > >
    > >>A user will fill out the dropdown list and hit submit - a form will then
    > >> map the constants to the form values to build a SQL string that will
    > >>be passed to a stored procedure.
    > >>
    > >>Ray at <%=sLocation%> [MVP] wrote:
    > >>
    > >>
    > >>>When, when the page is submitted? When it is loaded? Can you explain

    > >
    > > this
    > >
    > >>>in a little more detail?
    > >>>
    > >>>Ray at work
    > >>>
    > >>>"Dave Karmens" <> wrote in message
    > >>>news:%23FJWoTL$...
    > >>>
    > >>>
    > >>>>No, I would need to loop though the values of a drop down list and
    > >>>>assign value1 to email, value2 to fname...
    > >>>>
    > >>>>Ray at <%=sLocation%> [MVP] wrote:
    > >>>>
    > >>>>
    > >>>>
    > >>>>>What do you mean? <input type="text" value="<%=variableName%>">
    > >>>>>
    > >>>>>Ray at work
    > >>>>>
    > >>>>>"Dave Karmens" <> wrote in message
    > >>>>>news:%23MaQ2JL$...
    > >>>>>
    > >>>>>
    > >>>>>
    > >>>>>>If I have say 10 fixed variables, how can I set their values = to

    that
    > >>>>>>of a form that is built dynamically?
    > >>>>>>
    > >>>>>>column1 column2
    > >>>>>>email = formvalue(0)
    > >>>>>>fname = formvalue(1)
    > >>>>>>lname = formvalue(2)
    > >>>>>>
    > >>>>>>etc..
    > >>>>>>
    > >>>>>>lastvar = formvalue(9)
    > >>>>>
    > >>>>>
    > >>>>>
    > >>>

    > >
    > >
    Ray at, Feb 27, 2004
    #10
  11. Dave Karmens

    Dave Karmens Guest

    Aaaah that looks like it will do! Thanks Ray!


    Ray at <%=sLocation%> [MVP] wrote:

    > In that case, split your select value and assign the values to your
    > variables, like:
    >
    > On Error Resume Next
    > firstvar = Request.Form("select")(1)
    > secondvar = Request.Form("select")(2)
    > thirdvar = Request.Form("select")(3)
    > fourthvar = Request.Form("select")(4)
    > fifthvar = Request.Form("select")(5)
    > sixthvar = Request.Form("select")(6)
    > seventhvar = Request.Form("select")(7)
    > eighthvar = Request.Form("select")(8)
    > ninthvar = Request.Form("select")(9)
    > tenthvar = Request.Form("select")(10)
    > On Error Goto 0
    >
    > Ray at work
    >
    >
    >
    >
    > "Dave Karmens" <> wrote in message
    > news:Oze$HtT$...
    >
    >>Hey Ray, thanks for sticking in...
    >>
    >>I'll have an unknown number of values loaded from the .CSV, but no more
    >>than 10. There will also be a fixed number of variables to assign them
    >>to. If there is only 7 loaded the rest will be set to "".
    >>
    >>The .csv might have user user_email, first_name, last_name so they would
    >>map those to the fixed values email, fname, lname.
    >>
    >>The SQL string is a very simple insert:
    >>
    >>insert into tbl_test (email, fname, lname)
    >>values ('"&user_email&"','"&first_name&"','"&last_name&"')
    >>
    >>
    >>This is the basic idea:
    >>
    >><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    >>"http://www.w3.org/TR/html4/loose.dtd">
    >><html>
    >><head>
    >><title>Untitled Document</title>
    >><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    >></head>
    >><body>
    >><table width="300">
    >> <tr>
    >> <td>Fixed List</td>
    >> <td>CSV List</td>
    >> </tr>
    >> <tr>
    >> <td>Email</td>
    >> <td><select name="flds">
    >> <option name="none" value="none">none</option>
    >> <option name="user_email" value="user_email">user_email</option>
    >> <option name="user_fname" value="user_fname">user_fname</option>
    >> <option name="user_lname" value="user_lname">user_lname</option>
    >> </select></td>
    >> </tr>
    >> <tr>
    >> <td>First Name</td>
    >> <td><select name="flds">
    >> <option name="none" value="none">none</option>
    >> <option name="user_email" value="user_email">user_email</option>
    >> <option name="user_fname" value="user_fname">user_fname</option>
    >> <option name="user_lname" value="user_lname">user_lname</option>
    >> </select></td>
    >> </tr>
    >> <tr>
    >> <td>Last Name</td>
    >> <td><select name="flds">
    >> <option name="none" value="none">none</option>
    >> <option name="user_email" value="user_email">user_email</option>
    >> <option name="user_fname" value="user_fname">user_fname</option>
    >> <option name="user_lname" value="user_lname">user_lname</option>
    >> </select></td>
    >> </tr>
    >></table>
    >></body>
    >></html>
    >>
    >>Ray at <%=sLocation%> [MVP] wrote:
    >>
    >>>So, you'll have an unknown number of values to assign to an unknown

    >
    > number
    >
    >>>of variables? What about putting them in an array? If I fill out your
    >>>form, and I enter these terms in your select box:
    >>>
    >>>cat
    >>>bird
    >>>ferret
    >>>
    >>>what is the ultimate goal as far as what your SQL string will look like?
    >>>
    >>>Ray at home
    >>>
    >>>"Dave Karmens" <> wrote in message
    >>>news:eqMXBmL$...
    >>>
    >>>
    >>>>A user will fill out the dropdown list and hit submit - a form will then
    >>>> map the constants to the form values to build a SQL string that will
    >>>>be passed to a stored procedure.
    >>>>
    >>>>Ray at <%=sLocation%> [MVP] wrote:
    >>>>
    >>>>
    >>>>
    >>>>>When, when the page is submitted? When it is loaded? Can you explain
    >>>
    >>>this
    >>>
    >>>
    >>>>>in a little more detail?
    >>>>>
    >>>>>Ray at work
    >>>>>
    >>>>>"Dave Karmens" <> wrote in message
    >>>>>news:%23FJWoTL$...
    >>>>>
    >>>>>
    >>>>>
    >>>>>>No, I would need to loop though the values of a drop down list and
    >>>>>>assign value1 to email, value2 to fname...
    >>>>>>
    >>>>>>Ray at <%=sLocation%> [MVP] wrote:
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>>What do you mean? <input type="text" value="<%=variableName%>">
    >>>>>>>
    >>>>>>>Ray at work
    >>>>>>>
    >>>>>>>"Dave Karmens" <> wrote in message
    >>>>>>>news:%23MaQ2JL$...
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>>>If I have say 10 fixed variables, how can I set their values = to

    >
    > that
    >
    >>>>>>>>of a form that is built dynamically?
    >>>>>>>>
    >>>>>>>>column1 column2
    >>>>>>>>email = formvalue(0)
    >>>>>>>>fname = formvalue(1)
    >>>>>>>>lname = formvalue(2)
    >>>>>>>>
    >>>>>>>>etc..
    >>>>>>>>
    >>>>>>>>lastvar = formvalue(9)
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>

    >
    >
    Dave Karmens, Feb 27, 2004
    #11
    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. Richard Dixson
    Replies:
    1
    Views:
    507
    Joe Fallon
    May 18, 2004
  2. Richard Dixson
    Replies:
    2
    Views:
    730
    Richard Dixson
    May 18, 2004
  3. fred schulz
    Replies:
    0
    Views:
    136
    fred schulz
    Jan 30, 2004
  4. pizzy
    Replies:
    4
    Views:
    138
    pizzy
    Mar 18, 2005
  5. pizzy
    Replies:
    7
    Views:
    154
    pizzy
    Mar 23, 2005
Loading...

Share This Page