CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Urgent:Submitting The ASP FORM

    Hi,
    I am developing an ASP form Which contains three combo boxes.I have to
    populate the values in other combo boxes based on the selection in one combo box.When the First combo box Change event occurs,I have to submit the form
    to filter the records for the second combo.
    Please give me some sample code.
    Thanx in Advance.

    Love,
    Ram


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Urgent:Submitting The ASP FORM

    Heres a sample of how to post a form to another asp page:

    'yourpage1.asp will post to yourpage2.asp

    'build the input form in HTML
    <form method=post action=yourpage2.asp>
    <select name=DropDown1>
    <option value=1>The First option</option>
    <option value=2 selected>The Second option</option>
    <option value=3>The Third option</option>
    </select>

    <input type=submit value=' Submit Form '>  <input type=reset value' Reset Form '>
    </form>



    when the user clicks the submit button the choice will be passed to yourpage2.asp, as follows:

    'yourpage2.asp

    <%@ Language=VBScript %>

    <html>
    <body>
    'a bunch of layout design and whatnot...

    'place where you need to know what was chosen from the previous page.
    <%
    dim iChoice

    iChoice = Request.Form("DropDown1")

    Select Case iChoice
    Case 1
    Response.write "You chose the first option.<BR>"
    Case 2
    Response.write "You chose the second option.<BR>"
    Case 3
    Response.write "You chose the third option.<BR>"
    End Select
    %>

    'the rest of your html page.
    </body>
    </html>




    You should be able to see what is going on with the previous page's form values and how to work around that value. In the select block, you would build a string that holds the HTML for the next drop down box. you would obviously change the available options in the drop down depending on the value of iChoice (or whatever you called it).

    i hope this helps,
    john

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured