Solved

I have 2 submit buttons  where I added code for each buttons click event to change the action page to different pages, I am getting Jva script error and Pages are not redirecting

Posted on 2003-11-13
4
408 Views
Last Modified: 2010-04-09
I have 2 submit buttons  where I added code for each buttons click event to change the action page to different pages, I am getting Jva script error and Pages are not redirecting when I click on the
Below is the ASp page I am attaching, Please tell me Where I am doing wrong
Please........

<%@ Language=VBScript %>
<%Option Explicit%>

<%'Author: Selina Chang
  'Date: August 7, 2000
  'Page: approveuser.asp
  'Purpose: Shows a list of users that need to be approved. Admin can select users that are
  '                  waiting to be approved.      
  Dim sButton            
%>


<% If Session("AdminID") = "" Then

Response.Redirect "adminlogin.asp"

Else %>
<!-- #include file="toptemp2.asp" -->
<% End if %>
                  
<TR>
<TD colspan=7 nowrap>
<P><FONT COLOR="red">Please check the box next to the Person ID to approve an User.<BR>
Click the Approve button at the end of the table after your selections</FONT></P>
<TABLE BORDER=1 WIDTH="100%" align=Center>
<TR>                              <!-- setting up the table for search results-->

<TD nowrap>
<CENTER><P><FONT FACE="Comic Sans MS" SIZE=+1>Approve</FONT></p></CENTER>
</TD>

<TD nowrap>
<CENTER><P><FONT FACE="Comic Sans MS" SIZE=+1>Person ID</FONT></p></CENTER>
</TD>
                                                            
<TD nowrap>
<CENTER><P><FONT FACE="Comic Sans MS" SIZE=+1>First Name</FONT></p></CENTER>
</TD>

<TD nowrap>
<CENTER><P><FONT FACE="Comic Sans MS" SIZE=+1>Last Name</FONT></p></CENTER>
</TD>

<TD nowrap>
<CENTER><P><FONT FACE="Comic Sans MS" SIZE=+1>User ID</FONT></p></CENTER>
</TD>

<TD nowrap>
<CENTER><P><FONT FACE="Comic Sans MS" SIZE=+1>Password</FONT></p></CENTER>
</TD>

<TD nowrap>
<CENTER><P><FONT FACE="Comic Sans MS" SIZE=+1>Phone</FONT></p></CENTER>
</TD>

</TR>

<%
Response.Write "<FONT FACE=Comic Sans MS>"

Dim intCount                                                            'Keeps the number of records found
Dim strConn                                                                  'set up the connection string
Dim objRec                                                                        'Open a recordset object
Dim strSQL

Catalog=prodemkt;Data Source=foxhound.nigas.com,2025;" %>
<!-- #include file="DataConn.asp" -->

<%

strSQL = "SELECT PersonID, FirstName, LastName, UserID, Password,Phone, Approved"
strSQL = strSQL + " FROM Person WHERE Approved = 0"
strSQL = strSQL + " ORDER BY PersonID;"

Set objRec=Server.CreateObject ("ADODB.Recordset")
objRec.Open strSQL, strConn

'Select records in the data base that match the query under the category, short_description,
'and long_descrption columns
'objRec.Filter = "Category Like '*" & Request.Form("keywords") & "*' OR ItemName Like '*" & Request.Form("keywords") & "*' OR ShortDescription Like '*" & Request.Form("keywords") & "*' OR LongDescription Like '*" & Request.Form("keywords") & "*'"

intCount=0
'Response.Write "<FORM METHOD='POST' Action ='approveuser2.asp' id=form1 name=form1>"
Response.Write "<FORM id=form1 name=form1 Method = 'Post'>"
While Not objRec.EOF

If Not objRec("Approved") Then
intCount=intCount+1

Response.Write "<TR>"

Response.Write "<TD align='center'>"
Response.Write "<INPUT TYPE='checkbox' NAME='Approved' VALUE='" & objRec("PersonID")& "'>"
Response.Write "&nbsp;</TD>"

Response.Write "<TD align='center'>"
Response.Write objRec("PersonID")
Response.Write "&nbsp;</TD>"

Response.Write "<TD>"
Response.Write objRec("FirstName")
Response.Write "&nbsp;</TD>"

Response.Write "<TD>"
Response.Write objRec("LastName")
Response.Write "&nbsp;</TD>"

Response.Write "<TD>"
Response.Write objRec("UserID")
Response.Write "&nbsp;</TD>"

Response.Write "<TD>"
Response.Write objRec("Password")
Response.Write "</TD>"

Response.Write "<TD nowrap>"
Response.Write objRec("Phone")
Response.Write "&nbsp;</TD>"


End if
objRec.MoveNext

Wend

If intCount=0 then
Response.Write "<TR Colspan=8> <TD colspan=7> Sorry, no New User found... </TD></TR>"
end If

Response.Write "<TR><TD COLSPAN=8><INPUT TYPE='Submit' NAME='btnApprove' VALUE='Approve' onclick='action='approveuser2.asp';'>&nbsp;<INPUT TYPE='Submit' NAME='btnDelete' VALUE='Delete' onclick='action='approveform.asp';'>&nbsp;<INPUT TYPE='Reset'></TD></TR>"
Response.Write "</FORM>"
Response.Write "</FONT>"

objRec.Close
set objRec = Nothing


 %>
 </Table>
 <P>&nbsp;</P>
 </TD></TR>
 

<!-- #include file="bottomtemp.asp"-->

0
Comment
Question by:suruku
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 9741740
Response.Write "<TR><TD COLSPAN=8><INPUT TYPE='submit' NAME='btnApprove' VALUE='Approve' onclick=""this.form.action='approveuser2.asp';"" />&nbsp;<INPUT TYPE='submit' NAME='btnDelete' VALUE='Delete' onclick=""this.form.action='approveform.asp';"">&nbsp;<INPUT TYPE='Reset'></TD></TR>"
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9741762
use double double-quotes "" to produce one double-quote in the HTML.  Essentially, this is what I changed:

onclick=""this.form.action='approveuser2.asp';""

onclick=""this.form.action='approveform.asp';""
0
 

Author Comment

by:suruku
ID: 9741862
knightEknight
What should I put in Form Action value in the form tag And should I include Method = post

Please advice
Response.Write "<FORM id=form1 name=form1 Method = 'Post'>"
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 140 total points
ID: 9741992
You can put in a default action, and I would recommend quoting all the attributes:

Response.Write "<FORM id='form1' name='form1' Method='Post' action='approveform.asp' >" 
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question