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

    Join Date
    Feb 2002
    Rep Power

    Javascript - Radio selection to Add and Edit

    I am displaying all sql records.
    I have new_customer.asp file and edit_customer.asp
    If user checks I want to send the user to edit_customer.asp,
    if he submits without checking,
    I want send user to add_customer.asp.
    I coded like below. I am submitting page it self.

    Some bugs are there. Help me with code. Thank you.
    <!-- file name - submitHere.asp" -->
    set conn=Server.CreateObject("ADODB.Connection")
    conn.open "dsn=northwind"
    set rs = Server.CreateObject("ADODB.Recordset")
    sql = "Select * from CUSTOMERS where country = 'USA' order by CUSTOMERID"
    rs.Open sql, conn

    Do Until rs.EOF %>
    <form action="submitHere.asp" method="post">
    <table border="1" cellpadding=0" cellspacing="0">
    <td width="30" align="center"><input type="radio" name="radioSelect" value='"<%= rs("CustomerID") %>"'></td>
    <td width="300"><%= rs("CompanyName") %></td>
    <td><input type="submit" name="Submit" value="Add New"></td>
    <td><input type="submit" name="Submit" value="Edit Existing"></td>
    <td><input type="reset" name="reset" value="reset"></td>
    Dim gotoSelection
    gotoSelection = Request.form("radioSelect")

    If gotoSelection = "1" Then
    ' If value is selected edit existing customer
    Response.redirect "GOTO_EDIT.ASP"
    Elseif gotoSelection = "0" Then
    ' If value is not checked go to add new a customer
    Response.redirect "GOTO_ADD_NEW.ASP"
    End if


  2. #2
  3. No Profile Picture
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2001
    Rep Power
    <td><input type="submit" name="Submit" value="Add New"></td>
    <td><input type="submit" name="Edit" value="Edit Existing"></td>

    and use your asp coding to find if variable submit or variable edit exists..
    Visit my new IIS Tutorial Series!

IMN logo majestic logo threadwatch logo seochat tools logo