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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

840 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