Forum Moderators: open

Message Too Old, No Replies

My Submot Button Does not Work

         

coder1997

6:16 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



I am trying to create a simple submit form for users so they can request reports. Below is my code,I have following problems can any one help me solve this

1. the first field Ticket Id is suppose to increment by itself but it doesn't

2. When I hit submit it does not add the records into my database, I have checked all the settings, checked to make sure that I am pointing to the right database and small stuff like that.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--#include file="../system/cmsopen.asp"-->
<!--#include file="../system/fn_authentication.asp"-->
<!--#include file="../system/functions.asp"-->
<HTML>
<HEAD>
<title>
<%=pageTitle%>
</title>
<%
pageTitle="Report Request"
basepath="../"

%>
<link href="../css/standard.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/javascript">
<!--
function closeWindow()
{
window.confirm("Do you want to submitt the form?");

}
//-->
</script>

</HEAD>
<body id="parFont" bgcolor="#eaeaea">
<!--#include file="../layout/pagestart.asp"-->
<%

Dim con, sql
Response.Write "Request Method = " & Request.ServerVariables("REQUEST_METHOD") & "<br><br>"

Response.Write "Form name ¦ Value"

for each item in request.form()
response.write item & " ¦ " & request.form(item) & "<br>"
next
'response.end

if request.form("submit") = "Submit" then

Set con = Server.CreateObject("ADODB.Connection")
con.Open Application("CMSConn")

strRequestorName = request.form("Requestorname")
strRequestorEmail = request.form("RequestorEmail")
strPhone = request.form("Phone")
strDescription = request.form("Description")
strRequestedDate = request.form("RequestedDate")
strTurnoverDate = request.form("TurnoverDate")
strRequestingDept = request.form("RequestingDept")
strTypeofRequest = request.form("TypeofRequest")
strTypeofAging = request.form("TypeofAging")
strAssigneeName = request.form("AssigneeName")
strCompletedDate = request.form("CompletedDate")
strStatus = request.form("Status")

SQL = "INSERT INTO cwm_Report_Request_Form" & _
" VALUES('" & strRequestorName & "', '" & strRequestorEmail & "', '" & strPhone & "', '" & strDescription & "', '" & strRequestedDate & "', '" & strTurnoverDate & "', '" & strRequestingDept & "', '" & strTypeofRequest & "', '" & strTypeofAging & "', '" & strAssigneeName & "', '" & strcompleteddate & "', '" & strStatus & "')"

response.Write(SQL)
''response.End

con.execute(SQL)
con.Close
Set con = Nothing
end if

%>

<form name="ReportRequest" action="<%=basepath%>Admin/reportrequest.asp" enctype="multipart/form-data" method="Post" ID="Form1" >
<table id="parfont" cellspacing="1" cellpadding="2">
<tr>
<td>Ticket Id:</td>
<td><input type="text" name="TicketId" size="40" maxlength="255"></td>
</tr>
<tr>
<td>Requestor Name:</td>
<td><input type="text" name="RequestorName" size="40" maxlength="255" value="Amber"></td>
</tr>
<tr>
<td>Requestor Email:</td>
<td><input type="text" name="RequestorEmail" size="40" maxlength="255"></td>
</tr>
<tr>
<td>Phone</td>
<td><input type="text" name="Phone" size="40" maxlength="255"></td>
</tr>
<tr>
<td>Requesting Department:</td>
<td><select name="dept">
<option value="select" selected>Select</option>
<option value="global">Global</option>
<option value="national">National</option>
<option value="regional">Regional</option>
<option value="resellers">Resellers</option>
<option value="Government">Government</option>
<option value="Agency">Agency</option>
</select></td>
</tr>
<tr>
<td>Description</td>
<td><input type="text" name="Description" size="40" maxlength="255"></td>
</tr>
<tr>
<td>DateRequested</td>
<td><input type="text" name="DateRequested" size="40" maxlength="255"></td>
</tr>
<tr>
<td>TurnOverDate</td>
<td><input type="text" name="TurnOverDate" size="40" maxlength="255"></td>
</tr>
<tr>
<td>Status</td>
<td><select name="Status">
<option value="None" selected>Select One</option>
<option value="Open">Open</option>
<option value="Hold">Hold</option>
<option value="WaitingCustomerInput">WaitingInput</option>
<option value="Closed">Closed</option>
</select></td>
</tr>
<tr>
<td>CompletedDate</td>
<td><input type="text" name="CompletedDate" size="40" maxlength="255"></td>
</tr>
<tr>
<td>AssignedName</td>
<td><select name="AssignedName">
<option value="Null" selected>Select One</option>
<option value="AmberAhmed">Amber Ahmed</option>
<option value="NancyTobin">Nancy Tobin</option>
<option value="ScottWishkoski">Scott Wishkoski</option>
</select></td>
</tr>
<tr>
<td>Output Link</FONT></td>
<td><input maxlength="40" size="40" name="OutputLink"></td>
</tr>
<tr>
<td>Please provide details on the request:</td>
<td><textarea name="Details" rows="5" cols="25" maxlength="400"></textarea></td>
</tr>
<tr>
<td>Type of Aging</td>
<td><input type="radio" value="standard" name="aging" CHECKED>Standard <input type="radio" value="every30" name="aging">
30,60,90 Every 30 <input type="radio" value="monthly" name="aging">ARCS/Monthly
</td>
</tr>
<TR>
<TD></TD>
<TD></TD>
</TR>
<tr>
<td>Type of Request</td>
<td><select name="TypeofRequest">
<option value="select" selected>Select</option>
<option value="AddData">AddData</option>
<option value="Aging">Aging</option>
<option value="CollectorReporting">CollectorReporting</option>
<option value="DSO">DSO</option>
<option value="Segmentation">Segmentation</option>
<option value="Targets">Targets
</option>
</select></td>
</tr>
<TR>
<TD></TD>
<TD></TD>
</TR>
<tr>
<td>Pick a file to upload:</td>
<td><input type="file" name="test" size="50" ID="File1"></td>
</tr>
<TR>
<TD></TD>
<TD></TD>
</TR>
<tr>
<td></td>
<td><input type="button" name="cancel" value="Cancel" ID="Button1">
<!---input onclick= "closeWindow();" type= "submit" name="submit12" value=" Save " ID="Submit"-->
<input type="submit" name="submit" value="Submit" ID="Button1">
</td>

</tr>
</table>
</form>

<p>
This system requires user identification. Please logon first.<br>
[ <a id="parLink" href="logon.asp">Click here to proceed to logon screen</a> ]
</p>
<!--#include file="../system/cmsclose.asp"-->
</body>
</HTML>

can anyone please help me figure out why it will not increment and why it will not submit the records in my table.

oxbaker

6:39 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



did you set a break point and try debugging? What line does it break on?

coder1997

7:02 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



YES I DID

coder1997

7:02 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



if request.form("submit") = "Submit" then

It doest not go thru this if statement.

smells so good

7:58 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



I'm out of my league with ASP, you have been warned :)

strRequestorName = request.form("Requestorname")
Do you need one these to capture the submit?
Something like strRequestorSubmit = request.form("submit")

With PHP this would look like this - $submit = $_POST["submit"].

If that isn't the problem, then I would look a hard look at the form action.

[edited by: smells_so_good at 7:59 pm (utc) on Aug. 23, 2006]

coder1997

7:59 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



hey guys I resolved the submit problem, now my next problem is incrementing the ticketID.

any thoughts

smells so good

8:04 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



<input type="text" name="TicketId" size="40" maxlength="255">

Does the TicketID come from any other source besides this text input field?

coder1997

8:11 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



well in my database its suppose to increment, as its a identity seed column and i have set the value to yes.

Any thoughts

oxbaker

8:30 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



if its an identity id seed in a database then why would you even present that to the UI? Seeds are designed to always be unique, all you need to do is add all the OTHER fields and it will automatically insert itself, there is absolutely no reason to display that to a user as it should NEVER be used for display purposes.

coder1997

8:33 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



okay than how to do provide a ticket number to the user who is submitting the form, the reason I wanted to display it is that would serve as a ticket number for them, or do you know any other way of providing the user a ticket number when they do a submit form?

carlb007

8:08 am on Aug 24, 2006 (gmt 0)

10+ Year Member



you could use the id as a ticket number - imo this is fine. Other than that you could possibly create a long random integer on submit but there is no gaurantee it wont be repeated (although highly doubtful if its say 7 digits in length - depends on how big the site is i guess).

Try reading up on the Randomize and RND() functions in ASP if u want to go down the Random basket number route.
One advantage of doing this is that you dont start off with insanely small ID's which appear a little 'strange' to users - unless of course you start your id at say 100000.