# Masked Input Fields?

**URL:** <https://www.ruby-forum.com/t/masked-input-fields/57820>\
**Category:** Rails\
**Created:** [April 14, 2006, 3:23pm UTC](https://www.ruby-forum.com/t/masked-input-fields/57820 "2006-04-14T15:23:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xwordguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/65b543/32.png) [@xwordguy](https://www.ruby-forum.com/u/xwordguy)\
**Post date:** [April 14, 2006, 3:23pm UTC](https://www.ruby-forum.com/t/masked-input-fields/57820/1 "2006-04-14T15:23:53Z")

</div>

Fellow Rails Enthusiasts?

Does Ruby on Rails have a form helper function to create a masked text  
input  
field? For example, a mask for entering a phone number might look like:

( ) -

Also, does RoR have a function to set the focus to the first form field  
on a  
page? I usually use the following JavaScript function:

function FieldFocus() {  
if (document.forms.length \> 0) {  
document.forms[0].elements[0].focus();  
}  
}

along with:

But, if Rails comes with similar functionality built in I’d rather do it  
the  
Rails way.

Kevin  
[http://www.RawFedDogs.net](http://www.RawFedDogs.net)  
[http://www.WacoAgilityGroup.org](http://www.WacoAgilityGroup.org)  
Bruceville, TX
