#1
  1. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Mar 2008
    Posts
    341
    Rep Power
    8

    Form variable parsing problem


    I am having real trouble parsing a form variable from page to page and I am beginning to wonder that what I am trying to do might not be possible but I do not see why.

    First off I start with a simple page with a dropdown select called CompanyID

    This then goes to a page with a SQL select on it with the CompanyID as the selector and lists the results on the listing page. All works fine to this point.

    This page also contains an Add submit button with a hidden form field called CompanyID. If the add button is pressed it goes to another page with a form on it with another dropdown selector called CompanyID but since I have parsed the value from the previous page then this is preselected with the parsed CompanyID.

    Again all good to this point.

    Now this is where I get the problem. If I try and return to the listing page after submitting a form and writing the contents to the database then by vital CompnayID form variable is not coming over so the listing page returns an error.

    So to clarify if I just have a drop down selector then parse to the listing page all is well. However it seems if I have an actual submit form then my CompanyID is not getting parsed.

    Is there a way to parse the CompanyID back to the listing page as part of an actual form insert/update?
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,608
    Rep Power
    278
    it sounds like you problem is after saving record in database in separate page you need to send user back to original listing (send CompanyID).
    it could be done a few ways...
    I would prefer save your value in session, so in you save page
    save.asp page
    Code:
    <%
    'after saving record
    session("CompanyID") = request.form("CompanyID")
    %>
    on list page list.asp

    Code:
    <%
    if(request.form("CompanyID")="") then
    CompanyID=session("CompanyID") 
    end if
    session.abandon  ' delete session after read value in variable
    
    <select name="CompanyID">
    <option value="1" if CompanyID = "1" then response.write " selected " >company 1</option>
    <option value="2" if CompanyID = "2" then response.write " selected ">company 2</option>
    <option value="3" if CompanyID = "3" then response.write " selected ">company 3</option>
    <option value="4" if CompanyID = "4" then response.write " selected ">company 4</option>
    </select>
    %>
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
  4. #3
  5. No Profile Picture
    Registered User

    Join Date
    Mar 2010
    Location
    United States
    Posts
    11
    Rep Power
    0

    hey everyone


    simply stopping by to say hello

Similar Threads

  1. Replies: 4
    Last Post: November 10th, 2008, 02:57 AM
  2. Some REALLy odd form parsing..
    By Phrozt in forum ASP Development
    Replies: 4
    Last Post: May 30th, 2006, 09:51 AM
  3. URL to FORM variable problem
    By jbruso in forum HTML, JavaScript And CSS Help
    Replies: 1
    Last Post: February 24th, 2006, 03:08 PM
  4. Javascript: problem writing parsed variable to form text box
    By jbruso in forum HTML, JavaScript And CSS Help
    Replies: 13
    Last Post: October 5th, 2005, 12:29 PM
  5. Form Parsing
    By Thalandor in forum ASP Development
    Replies: 11
    Last Post: April 5th, 2005, 05:08 PM

IMN logo majestic logo threadwatch logo seochat tools logo