Hi Ray,
Thank you for replying to my post. I appreciate the help. How can I
capture the users input into a session variable before the user submits the
form?
When a user enters a value into a form field, can I set the session variable
to that value immediately?
Session("myvariablename") = ???
Is the Request.Form collection still available before the form is submitted?
Session("myvariablename") = Request.Form("yr")
Thanks again for the help.
-D-
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eJLGvxa1EHA.208@TK2MSFTNGP12.phx.gbl...[color=blue]
> Hi -D-,
>
> One of the things that you could do is write the current input into[/color]
session[color=blue]
> variables as you suggested, and then repopulate the values when you reload
> the page. Another option is to have the form post right back to
> fundingrequest.asp instead of abrinsert.asp. That way, your post data is
> available in the page already, and you can just use the request.form data
> that has already been entered. There are issues with doing this, though.
> Like, if someone presses Enter or Ctrl+M to submit the form, you have to
> make sure your code will know what action to take (reload page with new[/color]
row[color=blue]
> or process data).
>
> Another option is just to use client-side code if you want to be daring[/color]
with[color=blue]
> your visitors' browsers...
>
>
> <input name="btnNewRow" type="button" id="btnNewRow" value="New[/color]
Transaction"[color=blue]
> onClick="addRow()">
>
>
> <script type="text/javascript">
> var iRowCount = 0; //3? constant? generated from asp?
> function addRow() {
> iRowCount++;
> var oTable = document.getElementById('details')
> var oTbody = oTable.getElementsByTagName('TBODY')[0];
>
>
> var oRow = document.createElement('TR');
> oRow.id = 'trTrans' + iRowCount;
>
> var oTD1 = document.createElement('TD');
> oTD1.innerHTML = tdYear(iRowCount);
>
> var oTD2 = document.createElement('TD');
> oTD2.innerHTML = tdStrategy(iRowCount);
>
> var oTD3 = document.createElement('TD');
> oTD3.innerHTML = tdBudget(iRowCount);
>
> var oTD4 = document.createElement('TD');
> oTD4.innerHTML = tdBudgetObject(iRowCount);
>
> var oTD5 = document.createElement('TD');
> oTD5.innerHTML = tdOrigBudget(iRowCount);
>
> var oTD6 = document.createElement('TD');
> oTD6.innerHTML = tdIncDec(iRowCount);
>
>
>
> oRow.appendChild(oTD1);
> oRow.appendChild(oTD2);
> oRow.appendChild(oTD3);
> oRow.appendChild(oTD4);
> oRow.appendChild(oTD5);
> oRow.appendChild(oTD6);
> oTbody.appendChild(oRow);
>
> }
>
> function tdYear(n) {
> var s;
> s = '<input name=\"yr' + n + '\" type=\"text\" id=\"yr' + n + '\"
> size=\"5\" maxlength=\"25\">'
> return s;
> }
>
> function tdStrategy(n) {
> var s;
> s = '<select name=\"strategy' + n + '\">\n';
> s+= '\t<option selected>-select-</option>\n';
> //loop through options here, assuming there will be some!
> s+='</select>'
> return s;
> }
>
> function tdBudget(n) {
> var s;
> s = '<input name=\"BA' + n + '\" type=\"text\" size=\"15\">';
> return s;
> }
>
> function tdBudgetObject(n) {
> var s;
> s = '<select name=\"origBA1' + n + '\">\n';
> s+= '\t<option selected>-select-</option>\n';
> //loop through options here, assuming there will be some!
> s+='</select>'
> return s;
> }
>
> function tdOrigBudget(n) {
> var s;
> s = '<input name=\"origBA' + n + '\" type=\"text\"[/color]
value=\"10,000,000.00\"[color=blue]
> size=\"15\" maxlength=\"100\" readonly=\"true\">';
> return s;
> }
>
> function tdIncDec(n) {
> var s;
> s = '<input name=\"IncrDecr' + n + '\" type=\"text\" size=\"10\">';
> return s;
> }
> </script>
>
>
>
> Ray at home
>
>
>
> "-D-" <noone@nospam.com> wrote in message
> news:eMiK34Y1EHA.2624@TK2MSFTNGP11.phx.gbl...[color=green]
> > I'm trying to accomplish the following. I'm trying to get the values for
> > the
> > table rows that are dynamically created to persist through a redirect.
> >
> > Referring URL:
> >
http://www.dwayneepps.com/abr_site/fundingrequest.asp
> >
> > If you click on the "New Transaction" button it will generate a new row
> > for
> > the user to input information. I call a javascript function when the[/color][/color]
user[color=blue][color=green]
> > clicks the "New Transaction" button that redirects to another page that
> > processes some ASP code that builds a new row. I use a loop to create[/color][/color]
the[color=blue][color=green]
> > table rows by incrementing a session variable everytime the user clicks[/color][/color]
on[color=blue][color=green]
> > the "New Transaction" button.
> >
> > Here is the structure of the loop:
> > <%
> > Session("url") = 2
> > Dim x
> > For x = 0 to Session("TotalRowsB")
> > %>
> > <tr>
> > <td><input name="yr<%=x%>" type="text" id="yr<%=x%>"
> > value="<%=Session("yr")%>" size="5" maxlength="25"></td>
> > <td><select name="strategy<%=x%>">
> > <option selected>-select-</option>
> > </select></td>
> > <td><input name="BA<%=x%>" type="text" value="" size="15"></td>
> > <td><select name="BO<%=x%>">
> > <option selected>-select-</option>
> > </select></td>
> > <td><input name="origBA<%=x%>" type="text" value="10,000,000.00"
> > size="15" maxlength="100" readonly="true"></td>
> > <td><input name="IncrDecr<%=x%>" type="text" value=""
> > size="10"></td>
> > </tr>
> > <%
> > Next
> > %>
> >
> > The field names increment by one for every new row that is created. For
> > example, the field "yr" would be "yr1", "yr2", "yr3" on each pass[/color][/color]
through[color=blue][color=green]
> > the loop.
> >
> > I'm lost on how to maintain the user's input when a new row is created.
> > I'm
> > thinking I can use a session variable, but I'm not sure how to capture[/color][/color]
the[color=blue][color=green]
> > user's input into the session variable.
> >
> > Any help is greatly appreciated. Thanks.
> > -D-
> >
> >[/color]
>
>[/color]