I have been asked several times by customers what is the appropriate way to add a custom JavaScript validation when checking in a new Document or updating an existing one in content server. My answer is this:
Create a custom component and add a new resource. The name should be "clear_checkin_flags". Inside call on the super.clear_checkin_flags and then add your own checks. Here's an example:
Create a custom component and add a new resource. The name should be "clear_checkin_flags". Inside call on the super.clear_checkin_flags and then add your own checks. Here's an example:
<@dynamichtml clear_checkin_flags@> <$include super.clear_checkin_flags$> <$if strEquals(dDocType,"MyDocumentType")$> alert("The document type is not correct!"); <$endif$> <@end@>Note that when overwriting the clear_checkin_flags you are already inside a <script> tag so you shouldn't repeat it in your code!
Very useful. I was trying to do this and I could not find the right place. Great tip.
ReplyDelete