Ok, this is a good point you bring out, and it didn't cross my mind. How
though, would I do it?
I now have two inputs, incident = Trim(incident ) and solution =
Trim(solution ) <- these are the text fields.
what would the code be to check the length of the characters, and what is a
good recommendation todo if the string is longer that 1200 caracters?
Redirect them to a new page, with the same text box, and their text, but
with that which is longer than the 1200 caracters? I can't insert
half-cutoff sentences, so I would need to make them retype say the last
sentense or so.
--
Kind Regards
Rudi Ahlers
+27 (82) 926 1689
Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
: Verify the length of the input on the *server*
:
: a) javascript may not be running on the client
: b) javascript may have a bug
: c) ??
:
: You can't rely on client-side validation to protect the app, since the
code
: is running on an untrusted machine completely out of your server's
control.
: The only benefit to running javascript is to save the user a round-trip.
You
: need to reverify everything on the server.
:
: Cheers
: Ken
:
:
: : : Hi Bob
: :
: : I appreciate what you say. The page in question does have JavaScript to
: : limit the input. Here is the code:
: :
: : strsubject = Trim(strsubject )
: : incident = Trim(incident )
: : solution = Trim(solution )
: :
: : ticksubscriber = "N"
: : tickindustry = "N"
: : companycount = 0
: :
: : strcomment = GetFormData("strcomment")
: : subscriber = GetFormData("subscriber")
: : company_dont = GetFormData("company_dont")
: : industry = GetFormData("industry")
: : othersupplier = Trim(GetFormData("othersupplier"))
: : if subscriber = "0" then
: : 'tickindustry = "Y"
: : if company_dont ="0" then
: : else
: : othersupplier = company_dont
: : tickindustry = "Y"
: : end if
: : else
: : othersupplier = subscriber
: : ticksubscriber = "Y"
: : tickindustry = "Y"
: : end if
: : country = GetFormData("country")
: : province = Trim(GetFormData("strprovince"))
: : city = Trim(GetFormData("city"))
: : area = Trim(GetFormData("area"))
: : person = Trim(GetFormData("person"))
: : telno = GetFormData("telno")
: : datemonth = GetFormData("datemonth")
: : dateday = GetFormData("dateday")
: : dateyear = GetFormData("dateyear")
: : timehour = GetFormData("timehour")
: : timeminute = GetFormData("timeminute")
: : timeampm = GetFormData("timeampm")
: : alias = Trim(GetFormData("alias"))
: : fullname = Trim(GetFormData("fullname"))
: : emailaddress = Trim(GetFormData("emailaddress"))
: : tel1 = Trim(GetFormData("telnum1"))
: : tel2 = Trim(GetFormData("telnum2"))
: : contacttype = GetFormData("contacttype")
: :
: : if ((timehour = "") OR (timehour = " ")) then timehour = "1"
: : if ((timeminute = "") OR (timeminute = " ")) then timeminute = "00"
: : if ((timeampm = "") OR (timeampm = " ")) then timeampm = "AM"
: :
: : telnum1 = tel1 & " " & tel2
: : 'currentdate = Now()
: : currentdate = Month(Date())& "/" & Day(Date())& "/" & Year(Date())& " "
&
: : formatdatetime(now(),3)
: :
: : tempcompany = othersupplier
: :
: : thedate = datemonth & "/" & dateday & "/" & dateyear & " " & timehour &
: ":"
: : & timeminute & " " & timeampm
: :
: :
: :
: :
: : InsertQuery="INSERT INTO comments " &_
: : "(NUserID,thedate, currentdate, commenttype, userid, username,
: : supplier, person, subject, description, solution, industry, country,
: : province, city, area, emailsent, clientresponse, compliment,
: : complaint,telno,subscriber)" &_
: : " VALUES (" & Session("NUserID") & ", '" &_
: : thedate & "','" &_
: : currentdate & "','" &_
: : strcomment & "'," &_
: : Session("NUserID") & ",'" &_
: : alias & "','" &_
: : Replace(companyname,"'","''") & "','" &_
: : person & "','" &_
: : Replace(strsubject, "'", chr(39) & chr(39)) & "','" &_
: : Replace(incident, "'", chr(39) & chr(39)) & "','" &_
: : Replace(solution, "'", chr(39) & chr(39)) & "','" &_
: : industry & "','" &_
: : country & "','" &_
: : province & "','" &_
: : city & "','" &_
: : area & "','" &_
: : "no" & "','" &_
: : "" & "'," &_
: : compliment & "," &_
: : complaint & ",'" &_
: : telno & "','" & ticksubscriber & "');Select @@IDENTITY as id;"
: :
: :
: :
: : And the Javascript to limit the input:
: :
: :
: : function checkincident() {
: : var formname = document.commentform;
: : var incident = formname.incident.value;
: :
: : if (incident.length > 1199) {
: : alert("Please limit your Incident Description to 1200 characters!");
: : return(false);
: : }
: : }
: :
: : function checksolution() {
: : var formname = document.commentform;
: : var solution = formname.solution.value;
: :
: : if (solution.length > 1199) {
: : alert("Please limit your Solution to 1200 characters!");
: : return(false);
: : }
: : }
: :
: :
: : I hope this is useful
: :
: : --
: :
: : Kind Regards
: : Rudi Ahlers
: : +27 (82) 926 1689
: :
: : Greater love has no one than this, that he lay down his life for his
: friends
: : (John 15:13).
: : : : : The error is a warning that the string you are attempting to use to
set
: a
: : : column's value is too long to fit into the column which is being used.
: It
: : : has nothing to do with number of users, memory, etc. It means the
string
: : is
: : : too long.
: : :
: : : You will need to validate the comment and make sure it will fit into
the
: : : column for which it is intended. I can't get specific because I can't
: see
: : : the code you are using to pass this value to the database.
: : :
: : : In the future, please provide the ENTIRE error message. I happened to
: : : recognize this as a database error message, but others might not,
: causing
: : : them to waste their time and yours with irrelevant suggestions.
: : :
: : : Bob Barrows
: : :
: : : Lord Merlin wrote:
: : : > I hope someone can help me with this:
: : : >
: : : > Now, what makes it a bit more interesting. When I run the queries @
: : : > night, when there are less people on the site, it works fine, when I
: : : > run it during the day, it gives me this error. Can this directly be
: : : > related to server taking strain? Too high CPU / Memory usage?
: : : >
: : : > How would I debug / diagnose such a problem?
: : :
: : : --
: : : Microsoft MVP - ASP/ASP.NET
: : : Please reply to the newsgroup. This email account is my spam trap so I
: : : don't check it very often. If you must reply off-line, then remove the
: : : "NO SPAM"
: : :
: : :
: :
: :
:
: