asp vbscript textbox paste from word problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?R1ROMTcwNzc3?=

    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="VB SCRIPT" CODEPAGE="65001 "%>
    <!--#include file="../Connections/recruta2.asp" -->
    <%
    Dim MM_editAction
    MM_editAction = CStr(Request.Se rverVariables(" SCRIPT_NAME"))
    If (Request.QueryS tring <"") Then
    MM_editAction = MM_editAction & "?" & Server.HTMLEnco de(Request.Quer yString)
    End If

    ' boolean to abort record edit
    Dim MM_abortEdit
    MM_abortEdit = false
    %>
    <%
    ' IIf implementation
    Function MM_IIf(conditio n, ifTrue, ifFalse)
    If condition = "" Then
    MM_IIf = ifFalse
    Else
    MM_IIf = ifTrue
    End If
    End Function
    %>
    <% Session("NEWVAC ANCYTITLE") = Request.Form("t itle") %>
    <% Session("NEWVAC ANCYSECTOR") = Request.Form("j obtype") %>
    <% Session("NEWVAC ANCYLOCATION") = Request.Form("l ocation") %>
    <%
    If (CStr(Request(" MM_insert")) = "form1") Then
    If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateOb ject ("ADODB.Command ")
    MM_editCmd.Acti veConnection = MM_recruta2_STR ING
    MM_editCmd.Comm andText = "INSERT INTO dbo.Vacancy (VacancyTitle,
    VacancyCategory , VacancyLocation , VacancyType, VacancyPaye, VacancyDuration ,
    VacancyReferenc e, VacancyExpiryDa te, VacancyDescript ion, VacancyEmployer ID,
    VacancyEmployee ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
    MM_editCmd.Prep ared = true
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram1", 202,
    1, 50, Request.Form("t itle")) ' adVarWChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram2", 202,
    1, 50, Request.Form("j obtype")) ' adVarWChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram3", 202,
    1, 50, Request.Form("l ocation")) ' adVarWChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram4", 202,
    1, 50, Request.Form("c ontract")) ' adVarWChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram5", 202,
    1, 50, Server.HTMLEnco de(Request.Form ("payrate")) ) ' adVarWChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram6", 202,
    1, 50, Request.Form("d uration")) ' adVarWChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram7", 202,
    1, 50, Request.Form("r eference")) ' adVarWChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram8", 135,
    1, -1, MM_IIF(Request. Form("expirydat e2"), Request.Form("e xpirydate2"),
    null)) ' adDBTimeStamp
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram9", 201,
    1, -1, Server.HTMLEnco de(Request.Form ("description") )) ' adLongVarChar
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram10", 5, 1,
    -1, MM_IIF(Request. Form("SITEID"), Request.Form("S ITEID"), null)) ' adDouble
    MM_editCmd.Para meters.Append MM_editCmd.Crea teParameter("pa ram11", 5, 1,
    -1, MM_IIF(Request. Form("Employee" ), Request.Form("E mployee"), null)) '
    adDouble
    MM_editCmd.Exec ute
    MM_editCmd.Acti veConnection.Cl ose

    ' append the query string to the redirect URL
    Dim MM_editRedirect Url
    MM_editRedirect Url = "afternewvacanc y.asp"
    If (Request.QueryS tring <"") Then
    If (InStr(1, MM_editRedirect Url, "?", vbTextCompare) = 0) Then
    MM_editRedirect Url = MM_editRedirect Url & "?" & Request.QuerySt ring
    Else
    MM_editRedirect Url = MM_editRedirect Url & "&" & Request.QuerySt ring
    End If
    End If
    Response.Redire ct(MM_editRedir ectUrl)
    End If
    End If
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <script type="text/javascript" src="../Scripts/currentdate.js" ></script>
    <%
    Function fRandomReferenc e()
    Const sValidChars = "abcdefghijklmn opqrstuvxyz"
    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
    fRandomReferenc e = sRet
    End Function
    %><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Backoffi ce</title>
    <meta name="robots" content="noinde x,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;U RL=index.asp">
    <script src="../SpryAssets/SpryCollapsible Panel.js"
    type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/reflection.js"> </script>
    <script src="../calendar/calendar.js"></script>
    <link href="../SpryAssets/SpryCollapsible Panel.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="toptable backoffice"><ta ble border="0" cellpadding="0"
    cellspacing="0" class="toptable backoffice">
    <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="toptable backoffice2">
    <tr>
    <td class="recrutad ate"><script language="JavaS cript"
    type="text/javascript">
    document.write( "<span
    class=\"datetex t\">"+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="tdrecrut anavbar"><ul class="nav">
    <% If Not adminlevel.EOF Or Not adminlevel.BOF Then %>
    <li><a href="pagelist. asp">Page Manager</a></li>
    <li><a href="consultan tlist.asp">Cons ultant Manager</a></li>
    <li><a href="newslist. asp">News Manager</a></li>
    <li><a href="jobsearch criteria.asp">J obSearch Manager</a></li>
    <% End If ' end Not adminlevel.EOF Or NOT adminlevel.BOF %>
    <li><a href="oldregcan dlist.asp">Regi stered Users</a></li>
    <li><a href="jbemgnt.a sp">Jobs by Email Manager</a></li>
    <li><a href="account.a sp">Account</a></li>
    <li><a href="logout.as p">Log Out</a></li>
    </ul></td>
    </tr>
    <tr>
    <td><table border="0" cellpadding="0" cellspacing="0"
    class="recrutam ainarea">
    <tr>
    <td valign="top" class="tdrightr ecrutamain"><h1 >New Vacancy </h1>


    <p class="invalid" >Please complete all fields </p>
    <form ACTION="<%=MM_e ditAction%>" METHOD="POST" name="form1"
    id="form1">
    <table border="0" cellpadding="0" cellspacing="0"
    class="outervac ancytable">
    <tr>
    <td class="editvaca ncyvalue">Vacan cy Title:</td>
    <td class="editvaca ncyform"><label >
    <input name="title" type="text" id="title"
    maxlength="50" />
    </label></td>
    </tr>
    <tr>
    <td class="editvaca ncyvalue">Secto r:</td>
    <td class="editvaca ncyform"><label >
    <select name="jobtype" id="jobtype">
    <option selected="selec ted" value="">Select </option>
    <%
    While (NOT jobsectors.EOF)
    %>
    <option
    value="<%=(jobs ectors.Fields.I tem("Jobtype"). Value)%>"><%=(j obsectors.Field s.Item("Jobtype ").Value)%> </option>
    <%
    jobsectors.Move Next()
    Wend
    If (jobsectors.Cur sorType 0) Then
    jobsectors.Move First
    Else
    jobsectors.Requ ery
    End If
    %>
    </select>
    </label></td>
    </tr>
    <tr>
    <td class="editvaca ncyvalue">Locat ion:</td>
    <td class="editvaca ncyform"><label >
    <select name="location" id="location">
    <option selected="selec ted" value="">Select </option>
    <%
    While (NOT joblocations.EO F)
    %>
    <option
    value="<%=(jobl ocations.Fields .Item("JobLocat ion").Value)%>" ><%=(joblocatio ns.Fields.Item( "JobLocation"). Value)%></option>
    <%
    joblocations.Mo veNext()
    Wend
    If (joblocations.C ursorType 0) Then
    joblocations.Mo veFirst
    Else
    joblocations.Re query
    End If
    %>
    </select>
    </label></td>
    </tr>
    <tr>
    <td class="editvaca ncyvalue">Type: </td>
    <td class="editvaca ncyform"><label >
    <select name="contract" id="contract">
    <option selected="selec ted" value="">Select </option>
    <option value="Temporar y">Temporary </option>
    <option value="Permanen t">Permanent </option>
    <option value="Contract ">Contract</option>
    </select>
    </label></td>
    </tr>
    <tr>
    <td class="editvaca ncyvalue">Pay Rate:</td>
    <td class="editvaca ncyform"><label >
    <input name="payrate" type="text" id="payrate"
    maxlength="50" />
    </label></td>
    </tr>
    <tr>
    <td class="editvaca ncyvalue">Durat ion:</td>
    <td class="editvaca ncyform"><label >
    <input name="duration" type="text" id="duration"
    maxlength="50" />
    <input name="reference " type="hidden" id="reference"
    value="<%=fRand omReference()%> " />
    </label></td>
    </tr>
    <tr>
    <td class="editvaca ncyvalue">Adver t Expires on:</td>
    <td class="editvaca ncyform">
    <input name="expirydat e2" type="text" id="expirydate2 "
    onFocus="this.s elect();lcs(thi s)"
    onClick="event. cancelBubble=tr ue;this.select( );lcs(this)">
    </td>
    </tr>
    <tr>
    <td class="editvaca ncyvalue">Descr iption:</td>
    <td class="editvaca ncyform"><label >
    <textarea name="descripti on" 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("EMPLOY EEID") %>" /></td>
    <td class="editbutt on"><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
  • Tim Slattery

    #2
    Re: asp vbscript textbox paste from word problem

    GTN170777 <GTN170777@disc ussions.microso ft.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)
    Slattery_T@bls. gov

    Comment

    • =?Utf-8?B?R1ROMTcwNzc3?=

      #3
      Re: asp vbscript textbox paste from word problem

      Sorry Tim, it is actually the textarea description.

      Many thanks

      "Tim Slattery" wrote:
      GTN170777 <GTN170777@disc ussions.microso ft.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)
      Slattery_T@bls. gov

      >

      Comment

      • Adrienne Boswell

        #4
        Re: asp vbscript textbox paste from word problem

        Gazing into my crystal ball I observed =?Utf-8?B?R1ROMTcwNzc 3?=
        <GTN170777@disc ussions.microso ft.comwriting in
        news:9E1CC681-A79B-4B11-88FC-D073A9C7B6A4@mi crosoft.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
        Arbpen Consulting will help you harness valuable insights and translate them into tangible results by merging data and strategy.

        Please respond to the group so others can share

        Comment

        • Bob Milutinovic

          #5
          Re: asp vbscript textbox paste from word problem

          "GTN170777" <GTN170777@disc ussions.microso ft.comwrote in message
          news:9E1CC681-A79B-4B11-88FC-D073A9C7B6A4@mi crosoft.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 VacancyDescript ion
          column in the database?

          - Bob.


          Comment

          • =?Utf-8?B?QkBESko=?=

            #6
            Re: asp vbscript textbox paste from word problem

            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" <GTN170777@disc ussions.microso ft.comwrote in message
            news:9E1CC681-A79B-4B11-88FC-D073A9C7B6A4@mi crosoft.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 VacancyDescript ion
            column in the database?
            >
            - Bob.
            >
            >
            >

            Comment

            Working...