1 Reply Latest reply on Aug 22, 2014 3:37 AM by Bernd Alheit

    How do I maintain a specific format for a textbox that I've created?

    adesso89

      I would like for a textbox I've created to always display information gathered from a form in the following format:

       

      Name: Mr. John Smith                    Phone: 555-XXXX

      Email: JohnSmith@email.com         Cell: 555-XXXX

       

      The issue I have is that when the name or email fields are too long the format is messed up e.g.:

       

      Name: Mr. Jonhathan Smith                    Phone: 555-XXXX

      Email: JohnSmith@email.com         Cell: 555-XXXX

       

      I've tried experimenting with counting the length in combination with if/then statements but wasn't able to figure out a solution.

       

      I have the code below in a custom calculation script for my textbox:

       

      // linespace1 determines number of tabs to insert between the end of the name and beginning of phone

       

      if (name.length >= 18 var linespace1 = "\t\t")

       

      // Gather Infromation

       

      var name = "Name: " + this.getField("Name").value;

      var email = "Email: " + this.getField("email").value;

      var phone = "Phone: " + this.getField("phone").value;

      var cell = "Cell: " + this.getField("cell").value;

       

      var l = this.getField("Letter").value;

       

      // Display Info

       

      if (l == "A") {event.value = name + "\t\t" + phone + "\r" + email + "\t\t" + cell}

       

      I know just the basics with Javascript. Any help would be greatly appreciated.