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
405 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

777 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