Announcement

Collapse
No announcement yet.

Create a script in DSM for Proper Text

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

  • Create a script in DSM for Proper Text

    First of all I am new to DSM and trying to wrap my head around all of the functions and scripts involved. So with that said hope this makes sense.

    Wanting to create a script to have the title to be proper... for example if user inputs - production designer - for his title then I want it to look like this - Production Designer - on the business card.

    I have got Ucase() "Name" and Lcase() "email prefix" in the card as well... just need proper for the "Title".

    Thanks,
    Travis.

  • #2
    Hi Travis,

    Here is a JScript for title case:

    function Var1Cap()
    {
    String.prototype.toTitleCase = function()
    {
    return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
    }

    return VAR.GetS("xxxx").toTitleCase();
    }


    Please see line 8 that says "xxxx". It needs to be replaced with whatever the name of your input variable is. Attached is a simple example zip. I hope this helps you.

    Kind regards,
    Eric

    Attached Files

    Comment


    • #3
      Thank you :-)

      Comment

      Working...
      X