Modify Paste as New Copy Text

We have modified the validation for sys_title so that it only allows for a-zA-Z0-9 , “-” and “_” (and it is also unique per folder). We are using this field as the published filename (we didn’t want yet another field separate called “filename”). This has been working great, but now we have the following problem.

When copying content over and doing a “As New Copy” the default behavior is to call it “Copy (1) of XXXX” where XXXX is the original name.

What do we need to do in order to change the “Copy (1) of” part to “Copy_1_of”?

Thanks,
Jit

The Error which we get (the error text which we have customized and is unique to us):

Error executing action <Drop-Drop-Drop-Paste_As_New_Copy> : An unexpected error occurred while processing the CMS request. The error was: Validation error occurred while processing "psx_cevtBrief/vtBrief", validation error is: <?xml version="1.0" encoding="UTF-8"?>
<DisplayError errorCount="1">
   <GenericMessage>The following field(s) produced validation errors:</GenericMessage>
   <Details>
      <FieldError displayName="Filename:" submitName="sys_title">Filenames must be unique in each folder and cannot be empty. Filenames must not contain any spaces or special characters other than a "-" (dash) or "_" (underscore). </FieldError>
   </Details>

</DisplayError>

Jit,

You need to change the Clone Field Overrride for the sys_title field in the New Copy Relationship. In the document Implementing the Rhythmyx Relationship Engine, see Chapter 5, “Overriding Content Item Fields in Clones”. The section “Overriding the sys_title Field” should provide a pretty clear example of the type of change you need to make.

RLJII

Thanks,
That did it. Here is what i modified:

  • Change copy text
    ** System Design / Relationship Types / System / NewCopy
    ** Cloning Tab > sys_title > click on the […] in UDF column
    ** Change Pattern to from “Copy ($clone_count) of {0}” to “copy_$clone_count_{0}”

Hi Jit,
I have to do the same validation for another field. I did not start working on it but will have to do it soon.
Can I ask you how you did that ?
If you want to keep your code, I’ll understand.

Thanks,

Guillaume

Hi Guillaume,

I will assume that you know how to get to validation of fields.

For the sys_title (under “Content Types Global Configuration”) we have the following validation rule in place as a regular expression: [a-zA-Z0-9_-]+

Plus, we also have the extension “sys_ValidateUniqueName” as another validation rule (to make sure that there will only be one unique name per folder)

Hi Jit,

Thank you for your code. I’m not a king with regular expression :wink:
Just to make sure I understand, [a-zA-Z0-9_-]+ let you put lower and upper case character, digit, _ and - but what is the use of the + at the end ?

Thanks again,

Guillaume

As Jit’s buddy at work I shall answer. :smiley:

Yep, you are correct about what is inside the [] (note that you have to escape the “-” with a backslash since it’s a special character).

The + at the end means that anything between the [] can appear one or more times. Without it, you’d be saying you were allowing only a single character name (which, I’m guessing, is not what you’d want).

-Josh

[QUOTE=gtrottier;1321]Hi Jit,

Thank you for your code. I’m not a king with regular expression :wink:
Just to make sure I understand, [a-zA-Z0-9_-]+ let you put lower and upper case character, digit, _ and - but what is the use of the + at the end ?

Thanks again,

Guillaume[/QUOTE]