2 <script type="text/javascript" src="<%$p%>elements/masked_input_1.1.js">
6 <& /elements/tr-input-text.html, id => $id, @_ &>
7 <script type="text/javascript">
9 elm: document.getElementById('<%$id%>'),
10 format: '<% $opt{format} %>',
11 <% $opt{allowed} ? "allowed: '$opt{allowed}'," : '' %>
12 <% $opt{typeon} ? "typeon: '$opt{typeon}'," : '' %>
14 document.getElementById('<%$id%>').value = <% $value |js_string %>;
22 my $id = $opt{id} || sprintf('input%04d',int(rand(10000)));
23 my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value} || '';
26 Set up a text input field with input masking.
28 <& /elements/tr-input-mask.html,
29 format => '____-__-__',
30 #typeon => '_YMDhms', # which characters in the format represent blanks
31 #allowed => '0123456789', # characters allowed in the blanks
32 ... all other options as for tr-input-text.html
35 Note that the value sent on form submission will contain the mask
36 separators, and if value/curr_value is passed, it should also be
37 formatted to fit the mask.
39 Uses masked_input_1.1.js by Kendall Conrad, available under a Creative Commons
40 Attribution-ShareAlike license.