473,413 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

asp vbscript textbox paste from word problem

Hi Guys,

It's been a while, I've got a small problem that I could do with your
expertise on.
As you know (I Think) I build websites for recruitment agencies, part of the
website includes a job board facility and for job form entry I used a normal
form with a normal textbox, however what I'm finding now is that a lot of
recruitment consultants are pasting the job description into the textbox,
which when submitted is resulting in most of the text not being entered!!!

Is there any way around this?

I've attached the code -

Thank you

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/recruta2.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <"") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<% Session("NEWVACANCYTITLE") = Request.Form("title") %>
<% Session("NEWVACANCYSECTOR") = Request.Form("jobtype") %>
<% Session("NEWVACANCYLOCATION") = Request.Form("location") %>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_recruta2_STRING
MM_editCmd.CommandText = "INSERT INTO dbo.Vacancy (VacancyTitle,
VacancyCategory, VacancyLocation, VacancyType, VacancyPaye, VacancyDuration,
VacancyReference, VacancyExpiryDate, VacancyDescription, VacancyEmployerID,
VacancyEmployeeID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202,
1, 50, Request.Form("title")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202,
1, 50, Request.Form("jobtype")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202,
1, 50, Request.Form("location")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202,
1, 50, Request.Form("contract")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202,
1, 50, Server.HTMLEncode(Request.Form("payrate"))) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202,
1, 50, Request.Form("duration")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202,
1, 50, Request.Form("reference")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 135,
1, -1, MM_IIF(Request.Form("expirydate2"), Request.Form("expirydate2"),
null)) ' adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 201,
1, -1, Server.HTMLEncode(Request.Form("description"))) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 5, 1,
-1, MM_IIF(Request.Form("SITEID"), Request.Form("SITEID"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 5, 1,
-1, MM_IIF(Request.Form("Employee"), Request.Form("Employee"), null)) '
adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "afternewvacancy.asp"
If (Request.QueryString <"") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript" src="../Scripts/currentdate.js"></script>
<%
Function fRandomReference()
Const sValidChars = "abcdefghijklmnopqrstuvxyz"
Dim nCount
Dim sRet
Dim nNumber
Dim nLength
Randomize
nLength = Len( sValidChars )
For nCount = 1 To 10
nNumber = Int((nLength * Rnd) + 1)
sRet = sRet & Mid( sValidChars, nNumber, 1 )
Next
fRandomReference = sRet
End Function
%><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Backoffice</title>
<meta name="robots" content="noindex,nofollow">
<link href="Styles/clientsheet.css" rel="stylesheet" type="text/css">
<link href="Styles/clientforms.css" rel="stylesheet" type="text/css">
<meta http-equiv="refresh" content="1201;URL=index.asp">
<script src="../SpryAssets/SpryCollapsiblePanel.js"
type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/reflection.js"></script>
<script src="../calendar/calendar.js"></script>
<link href="../SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet"
type="text/css" />
<script type="text/javascript" src="../Scripts/check.js"></script>
</head>
<body>
<div id="wrapper">
<table border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
<td class="toptablebackoffice"><table border="0" cellpadding="0"
cellspacing="0" class="toptablebackoffice">
<tr>
<td><img src="../images/recrutalg.jpg" alt="Recruta" width="179"
class="reflect rheight50 ropacity33" id="recrlogo" /></td>
<td><table border="0" cellpadding="0" cellspacing="0"
class="toptablebackoffice2">
<tr>
<td class="recrutadate"><script language="JavaScript"
type="text/javascript">
document.write("<span
class=\"datetext\">"+doClock("W0","%20","D0","%20" ,"M0","%20","Y0")+"</span>");
</script></td>
</tr>
<tr>
<td class="loggedin"><%= Session("NAME") %you are logged in
</td>
</tr>
</table></td>
</tr>

</table></td>
</tr>
<tr>
<td class="tdrecrutanavbar"><ul class="nav">
<% If Not adminlevel.EOF Or Not adminlevel.BOF Then %>
<li><a href="pagelist.asp">Page Manager</a></li>
<li><a href="consultantlist.asp">Consultant Manager</a></li>
<li><a href="newslist.asp">News Manager</a></li>
<li><a href="jobsearchcriteria.asp">JobSearch Manager</a></li>
<% End If ' end Not adminlevel.EOF Or NOT adminlevel.BOF %>
<li><a href="oldregcandlist.asp">Registered Users</a></li>
<li><a href="jbemgnt.asp">Jobs by Email Manager</a></li>
<li><a href="account.asp">Account</a></li>
<li><a href="logout.asp">Log Out</a></li>
</ul></td>
</tr>
<tr>
<td><table border="0" cellpadding="0" cellspacing="0"
class="recrutamainarea">
<tr>
<td valign="top" class="tdrightrecrutamain"><h1>New Vacancy </h1>
<p class="invalid">Please complete all fields </p>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1"
id="form1">
<table border="0" cellpadding="0" cellspacing="0"
class="outervacancytable">
<tr>
<td class="editvacancyvalue">Vacancy Title:</td>
<td class="editvacancyform"><label>
<input name="title" type="text" id="title"
maxlength="50" />
</label></td>
</tr>
<tr>
<td class="editvacancyvalue">Sector:</td>
<td class="editvacancyform"><label>
<select name="jobtype" id="jobtype">
<option selected="selected" value="">Select</option>
<%
While (NOT jobsectors.EOF)
%>
<option
value="<%=(jobsectors.Fields.Item("Jobtype").Value )%>"><%=(jobsectors.Fields.Item("Jobtype").Value)% ></option>
<%
jobsectors.MoveNext()
Wend
If (jobsectors.CursorType 0) Then
jobsectors.MoveFirst
Else
jobsectors.Requery
End If
%>
</select>
</label></td>
</tr>
<tr>
<td class="editvacancyvalue">Location:</td>
<td class="editvacancyform"><label>
<select name="location" id="location">
<option selected="selected" value="">Select</option>
<%
While (NOT joblocations.EOF)
%>
<option
value="<%=(joblocations.Fields.Item("JobLocation") .Value)%>"><%=(joblocations.Fields.Item("JobLocati on").Value)%></option>
<%
joblocations.MoveNext()
Wend
If (joblocations.CursorType 0) Then
joblocations.MoveFirst
Else
joblocations.Requery
End If
%>
</select>
</label></td>
</tr>
<tr>
<td class="editvacancyvalue">Type:</td>
<td class="editvacancyform"><label>
<select name="contract" id="contract">
<option selected="selected" value="">Select</option>
<option value="Temporary">Temporary</option>
<option value="Permanent">Permanent</option>
<option value="Contract">Contract</option>
</select>
</label></td>
</tr>
<tr>
<td class="editvacancyvalue">Pay Rate:</td>
<td class="editvacancyform"><label>
<input name="payrate" type="text" id="payrate"
maxlength="50" />
</label></td>
</tr>
<tr>
<td class="editvacancyvalue">Duration:</td>
<td class="editvacancyform"><label>
<input name="duration" type="text" id="duration"
maxlength="50" />
<input name="reference" type="hidden" id="reference"
value="<%=fRandomReference()%>" />
</label></td>
</tr>
<tr>
<td class="editvacancyvalue">Advert Expires on:</td>
<td class="editvacancyform">
<input name="expirydate2" type="text" id="expirydate2"
onFocus="this.select();lcs(this)"
onClick="event.cancelBubble=true;this.select();lcs (this)">
</td>
</tr>
<tr>
<td class="editvacancyvalue">Description:</td>
<td class="editvacancyform"><label>
<textarea name="description" id="description"
rows="14"></textarea>
</label></td>
</tr>
<tr>
<td><input name="SITEID" type="hidden" id="SITEID"
value="<%= Session("SITEID") %>" />
<input name="Employee" type="hidden" id="Employee"
value="<%= Session("EMPLOYEEID") %>" /></td>
<td class="editbutton"><label>
<input name="submit" type="submit" id="submit"
value="Submit" />
</label></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="form1" />
</form>

I've removed some of the not important stuff -- thanks
Oct 9 '08 #1
5 3402
GTN170777 <GT*******@discussions.microsoft.comwrote:
>Hi Guys,

It's been a while, I've got a small problem that I could do with your
expertise on.
As you know (I Think) I build websites for recruitment agencies, part of the
website includes a job board facility and for job form entry I used a normal
form with a normal textbox, however what I'm finding now is that a lot of
recruitment consultants are pasting the job description into the textbox,
which when submitted is resulting in most of the text not being entered!!!
You didn't say which textbox is getting the problem, but I see three
<input type="text" ...controls, named "title", "payrate", and
"duration", that have a maxlength attribute of 50. Anything longer
then 50 characters that's pasted into any of these will be truncated.

--
Tim Slattery
MS MVP(Shell/User)
Sl********@bls.gov
http://members.cox.net/slatteryt
Oct 9 '08 #2
Sorry Tim, it is actually the textarea description.

Many thanks

"Tim Slattery" wrote:
GTN170777 <GT*******@discussions.microsoft.comwrote:
Hi Guys,

It's been a while, I've got a small problem that I could do with your
expertise on.
As you know (I Think) I build websites for recruitment agencies, part of the
website includes a job board facility and for job form entry I used a normal
form with a normal textbox, however what I'm finding now is that a lot of
recruitment consultants are pasting the job description into the textbox,
which when submitted is resulting in most of the text not being entered!!!

You didn't say which textbox is getting the problem, but I see three
<input type="text" ...controls, named "title", "payrate", and
"duration", that have a maxlength attribute of 50. Anything longer
then 50 characters that's pasted into any of these will be truncated.

--
Tim Slattery
MS MVP(Shell/User)
Sl********@bls.gov
http://members.cox.net/slatteryt
Oct 9 '08 #3
Gazing into my crystal ball I observed =?Utf-8?B?R1ROMTcwNzc3?=
<GT*******@discussions.microsoft.comwriting in
news:9E**********************************@microsof t.com:
It's been a while, I've got a small problem that I could do with your
expertise on.
As you know (I Think) I build websites for recruitment agencies, part
of the website includes a job board facility and for job form entry I
used a normal form with a normal textbox, however what I'm finding now
is that a lot of recruitment consultants are pasting the job
description into the textbox, which when submitted is resulting in
most of the text not being entered!!!

Is there any way around this?
You can use client side javascript to show the user how many characters
are left, and alert the user that the data was truncated.

Server side, check the length of the data, and return an error message
to the client if it is too long.

Including instructions on the form that the input should only be a
certain amount of characters will also help.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Oct 9 '08 #4
"GTN170777" <GT*******@discussions.microsoft.comwrote in message
news:9E**********************************@microsof t.com...
Hi Guys,

It's been a while, I've got a small problem that I could do with your
expertise on.
As you know (I Think) I build websites for recruitment agencies, part of
the
website includes a job board facility and for job form entry I used a
normal
form with a normal textbox, however what I'm finding now is that a lot of
recruitment consultants are pasting the job description into the textbox,
which when submitted is resulting in most of the text not being entered!!!

Is there any way around this?
Silly question time... What's the defined size of the VacancyDescription
column in the database?

- Bob.
Oct 16 '08 #5
Aye - that's my guess too - if it's varchar(n) the DB won't complain if you
try to stuff n+1000 into it, it'll just truncate (silently) at n when the
data is put into the DB.

"Bob Milutinovic" wrote:
"GTN170777" <GT*******@discussions.microsoft.comwrote in message
news:9E**********************************@microsof t.com...
Hi Guys,

It's been a while, I've got a small problem that I could do with your
expertise on.
As you know (I Think) I build websites for recruitment agencies, part of
the
website includes a job board facility and for job form entry I used a
normal
form with a normal textbox, however what I'm finding now is that a lot of
recruitment consultants are pasting the job description into the textbox,
which when submitted is resulting in most of the text not being entered!!!

Is there any way around this?

Silly question time... What's the defined size of the VacancyDescription
column in the database?

- Bob.
Oct 17 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Pete | last post by:
Does anyone have a simple html vbscript or other type of snippet they can share that appends a record to a access database via ADO or DAO? I would like to allow users that don't have Microsoft...
38
by: MLH | last post by:
I have 2 global constants declared in the same global module: Global Const MY_VERSION$ = "1.04" Global Const ProjectName$ = "MyProj" I have 2 global procedures designed to return the value of...
2
by: ChucRock | last post by:
Hi, I have the following code where there is some client side VBScript that does something and needs to pass a variable back to the ASP.NET page. When the page is updated through a postback, the...
8
by: Michael SL | last post by:
I have been looking in the newsgroup but cannot find what I need. I am using Visual Studio to to build a VB.Net application using System.Web.UI.Page NOT windows.forms. The server fills a textbox...
7
by: Itar | last post by:
I'm having a problem supressing characters in a text box. I only want alpha numeric characters (no special chars). I can handle the TextBox_KeyPress event to supress the invalid characters when...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
2
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, #...
6
by: Flyzone | last post by:
Hello, i'm trying to paste copied text from word into an input box. This text is saved into a oracle db and then used as text in another javascript. The problem is that using the saved text...
3
by: =?iso-8859-1?Q?Johnny_J=F6rgensen?= | last post by:
I've got a textbox where I filter the input in the KeyPress event to allow only certain characters. However, If the user cuts and pastes a text into the textbox, all text is entered - not only...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.