Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2009-07-07T10:25:05Z by SystemAdmin
JJ-cg
JJ-cg
3 Posts
ACCEPTED ANSWER

Pinned topic eForms for P8 - Disable the "paste" function

‏2008-10-21T10:44:19Z |
We have a problem with people using the "cut and paste" functionality to enter information into a Text Cell within a P8 eForm. However, as this information is coming from Word doucments there is usually a lot of "non-printable" characters included within the text.

My questions are:

1) is there a way of disabling the "paste" functionality within an eFrom?

2) is there a way of stripping out the "non-printable" characters from a Text Cell at the point of entry into an eForm?

Cheers!

JJ
Updated on 2009-07-07T10:25:05Z at 2009-07-07T10:25:05Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    53 Posts
    ACCEPTED ANSWER

    Re: eForms for P8 - Disable the "paste" function

    ‏2009-05-21T13:24:52Z  in response to JJ-cg
    We've had exactly the same issue. Then these invalid characters can cause issues when retrieving from CE or PE since they may be invalid XML characters depending on character sets used throughout the system.

    Anyway, the way we managed it was to use a javascript function to strip characters that were not of a certain character set. Something like the following (where only certain fields are processed)...

    function replaceWordChars(){
    for (var j=0;j <arr_fieldsToClean.length;j++){
    var input_string = form.findCell(arr_fieldsToClean[j]).getValue().toString();
    for ( var i=0; i<arr_find.length; i++ ) {
    var regex = new RegExp(arr_find[i], "gi");
    input_string = input_string.replace(regex, arr_replace[i]);
    }//for
    var rxp = //g;
    input_string = input_string.replace(rxp, " ");

    form.findCell(arr_fieldsToClean[j]).setValue(new Value(input_string));
    }
    }
  • SystemAdmin
    SystemAdmin
    53 Posts
    ACCEPTED ANSWER

    Re: eForms for P8 - Disable the "paste" function

    ‏2009-07-07T10:25:05Z  in response to JJ-cg
    JJ

    1) Paste can be disabled in eforms by using JavaScript to capture the key/mouse combination that performs the paste and choosing not to do anything. This woould generally apply on a per-form basis however an extra check could be made to work out which cell has focus and then make a decision on whether to paste into that cell or not, this would mean either a large .js file or lots of specific .js files.

    2) The previous poster has posted some script for this i believe which would work fine for replacing characters. Another option could be to identify the fields which contain the invlid characters and alert the user to the presence of the characters, this would be quite effective if formatting should be maintained.