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
402 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now