Link to home
Start Free TrialLog in
Avatar of somaghoshCU
somaghoshCU

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of somaghoshCU
somaghoshCU

ASKER

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.
Do you have a test page?

Or a jsfiddle.net?