Thread: asp-javascript

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0

    Question asp-javascript


    Hello,

    I have a page that submits a form to a target page and then submits another form to self consequtively within javascript function.

    code:

    function submitRowsToSelf(getformname)
    {
    SubmitCompareToTarget();
    document.forms[getformname].submit();
    }

    The target page has session variables that collects the form values.
    And displays them as a drop-down list. Onchange of drop-down the form is submitted in the target page.

    When I focus to the target window I can see the values listed in the drop-down, but onchange of the value, the form gets submitted, reloading the target page, with no values in the dropdown.

    code:

    Session("form_val")=Session("form_val")&","&request.form("list")
    listarr= Split(Session("form_val"), ",")

    arrdropdown="<select name=""02_compare"" onchange=""document.dropdownform.submit()"">"
    for yindex=0 to Ubound(listarr)
    arrdropdown=arrdropdown&"<option value=""" & listarr(yindex) &""""
    arrdropdown=arrdropdown&">" &listarr(yindex) &"</option>"
    next
    arrdropdown=arrdropdown&"</select>"

    response.write("<form name=""dropdownform"" method=""get"">")
    response.write arrdropdown
    response.write ("</form>")


    But incase I refresh the target page before changing the dropdown values, the dropdown list is retained. Also if only the form populating the dropdown list is posted from parent page, the list is retained.


    Can anyone tell me what happens after the second submit, how and why does the session variables get overwritten?

    Thanks for you help in advance.
    Last edited by joyk; March 26th, 2003 at 08:47 AM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    138
    Rep Power
    12
    I don't quite understand your first statement and the code that goes along with it?

    You say you submit two forms, one to a target page and one to the same page? I don't think this is possible. If you are using multiple windows or frames you need to make it clear.

    What is in "SubmitCompareToTarget();" is this the first submit?
    --

    ngibsonau
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0
    yes "SubmitCompareToTarget();" is the first submit, with get method to a target page in a second window. The second is a post to itself.

    The target page and the main page are in two windows.

    Both form does get submitted; but the only problem I face is the data collected in the session variable, in the target page vanishes when I change the dropdown.
    Last edited by joyk; March 26th, 2003 at 06:43 AM.

IMN logo majestic logo threadwatch logo seochat tools logo