New Year Offer - 20% OFF - Unlock Deal

Transforming Strings

WS Form can transform the case of text entered into fields as well as transforming the case of text using WS Form variables.

Demo

Transform Fields

Text based fields have a Transform setting that can be used to force the text to be either:

  • Uppercase
  • Lowercase
  • Capitalized
  • Sentence Case

The following field types support the transform functionality:

To apply a transformation, first click the edit icon on any field.

WS Form - Field Settings Icon

Next, click on the Advanced tab and then change the Transform setting.

WS Form - Field Transform Setting

Then click Save.

Now any text entered into that field will be transformed as it is typed according to the setting you choose.

Note that when the field is submitted it will retain the text transformation.

Transform Variables

It is also possible to transform strings using WS Form variables.

For example:

#upper(#field(123))

This would convert the value of field ID 123 to uppercase.

You can use this in conjunction with the #text variable to update a field in real time.

For example, putting the following in the default value of a text field:

#text(#upper(#field(123)))

Would insert the value of field ID 123 as an uppercase string.

The following variables can be used to transform strings (client-side and in actions):

VariableNameDescriptionUsage
#capitalize("string")Capitalize a stringReturns the capitalized version of an input string.Client-side & Actions
#lower("string")LowercaseReturns the lowercase version of the input string.Client-side & Actions
#name_first("string")Return the first name Returns the first name from a full name. For more information about this variable, click here.Client-side & Actions
#name_last("string")Return the last name Returns the last name from a full name. For more information about this variable, click here.Client-side & Actions
#name_middle("string")Return the middle name Returns the middle name from a full name. For more information about this variable, click here.Client-side & Actions
#name_prefix("string")Return the name prefix Returns the prefix from a full name. For more information about this variable, click here.Client-side & Actions
#name_suffix("string")Return the name suffixReturns the suffix from a full name. For more information about this variable, click here.Client-side & Actions
#sentence("string")Sentence case a stringReturns the sentence cased version of an input string.Client-side & Actions
#slug("string")Convert a string to a slugReturns the string as a slug suitable for URLs.Client-side & Actions
#trim("string")Trim a stringReturns the trimmed string.Client-side & Actions
#ucfirst("string")Uppercase first letterReturns the uppercase first letter version of the input string.Client-side & Actions
#ucwords("string")Uppercase wordsReturns the uppercase words version of the input string.Client-side & Actions
#upper("string")UppercaseReturns the uppercase version of the input string.Client-side & Actions
#wpautop("string")Apply wpautop to a stringReturns the string with wpautop applied to it.Client-side & Actions