• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

Random population in jQuery masked field

I am using jQuery.maskedInput-1.2.2.js.

A DOB field is masked as below:
$('.dob').mask("??99/99/9999");

The DOB field has the following details:
<div class="formItem">
  <s:date name="personBean.dob" var="formatvalue"
  format="MM/dd/yyyy" />
  <s:textfield key="form.common.label.dob" name="personBean.dob"
  value="%{#formatvalue}" labelSeparator="" size="20" id="dob"
  cssClass="required dob dateOfBirth" disabled="%{submittedFlag}" />
</div>

I am having an issue. Say, the user entered only last four digits 2000 and tab away. The value now converts to 20/00. The moment he comes back and clicks on the input field, random values are populated in that field e.g 20/00/_000. How to fix this problem?
0
somaghoshCU
Asked:
somaghoshCU
  • 2
1 Solution
 
Michel PlungjanIT ExpertCommented:
0
 
somaghoshCUAuthor Commented:
Hi mplungjan,

I did the following changes:

<script type="text/javascript" src="template/js/jquery.js"></script>
<script type="text/javascript" src="template/js/jquery.inputmask.js"></script>
<script type="text/javascript" src="template/js/jquery.inputmask.extensions.js"></script>

Also changed the mask as below:

$('.dob').inputmask("mm/dd/yyyy");

But the problem still persists. Please advise.
0
 
Michel PlungjanIT ExpertCommented:
Do you have a test page?

Or a jsfiddle.net?
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now