Tim Dietrich

Custom Software Developer

Home Services Portfolio Blog About Contact Newsletter

TVML: Displaying Alternate Keyboard Types

Earlier this week, I was working on an Apple TV app that included a newsletter signup function, which involved asking the user for their email address. The function uses the "formTemplate" TVML template type to display the form.

The function was easy enough to develop. However, the process of entering an email address was a bit tedious - mostly because the keyboard type that was displayed was generic, and not optimized for entering an email address.

Here's what the default keyboard type looks like:

I was curious as to whether TVML supported alternate keyboard types. Sure enough, it does. You can specify an alternate keyboard by using the "keyboardType" attribute of the textField element.

For example, to display a keyboard that makes entering an email address a bit easier, you can use the "emailAddress" keyboard type. Here's a code snippet:

  <description class="longDescriptionLayout">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</description>  
 <textField keyboardType="emailAddress">Your email address</textField>  
      <text>Button text</text>  

The "emailAddress" keyboard looks like this:

A list of other keyboard types is available here. However, other than the default and emailAddress types, I have not been able to get any of the other types to display.

In any case, if you are collecting an email address in a TVML app, consider using the "emailAddress" keyboard type to make entry a little easier.