Announcement

Collapse
No announcement yet.

CAPITALIZED letters

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • CAPITALIZED letters

    Hi, I'm trying to setup a form field with capitalized letters. How do I do that?
    Also, same question pertains text fields - how do you make it all CAPS?

  • #2
    Hi,

    In EFI VDP, you can use a Function called "UCase()" to force output to all caps provided you have set up the input variable off the InDesign document viewing area and the UCase function is used in a rules variable on the InDesign document set to cycle 2 that references the input variable. Please see attached screenshots and example template zip.

    Kind regards,
    Eric
    Attached Files

    Comment


    • Starbuck
      Starbuck commented
      Editing a comment
      Thank you!!
      Also I wonder, how can I test the way SmartCanvas works, after the design has been completed?

  • #3
    Hi,

    Unfortunately at the time of this post, there isn't a way to force capitalize text in SmartCanvas. A workaround though would be to use a font that is all caps only.

    Kind regards,
    Eric

    Comment


    • Tim.Daisy.Product.Manager
      Editing a comment
      We're working on adding forced caps and initial caps to form fields in SmartCanvas in the future. Stay tuned!

  • #4
    Hi there, I am doing somewhat complex JavaScript scripts and I need to access methods such as Ucase, Lcase, and other standard JS string methods but they don't work. I read the 2014 DSM manual but I don't find anything there. Also, I don't see any Formula Function for initial caps (Title Case)...

    Is there a way I could convert all strings to lowercase then using the array data type I can stitch the string back together?

    The only solution I'm finding is to apply a regex on the user form and force them to type in as expected but that's not as nice as reformatting whatever they type in.

    Thank you.

    Alejandro

    Comment


    • #5
      Hi,

      UCase and LCase are VBScript commands.
      An extended assignment will not work in an interface variable, it will be overwritten by the incoming value.
      You will need another variable in a higher working cycle to read the value e.g. by VAR.GetS("myVariable") from the interface, the value can given direct out by the return value.
      In use is the Windows Scripting Host, so VB and JScript in synchronous work only.
      Each Script in a VDP assignment needs to start with the keyword "function".
      A title case function in JavaScript can look like the following:
      function properCase(){
      var value = VAR.GetS("input");
      return value.replace(/\b\w+/g,
      function(txt){
      return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
      }
      );
      }

      Click image for larger version

Name:	image_331.png
Views:	36
Size:	98.1 KB
ID:	1196

      Comment


      • #6
        I came up with this, which worked out really great for me.


        Code:
        function titleCase() {
        String.prototype.toTitleCase = function()
        {
        return this.replace(/\w\S*/g, function(txt){
        return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
        });
        }
        var title = VAR.GetS("2Title").toTitleCase();
        var title2 = VAR.GetS("3Title2").toTitleCase();
        if ( title2 != "") {
        title += "\n" + title2;
        }
        return title
        }

        Comment

        Working...
        X