somaghoshCU
asked on
Random population in jQuery masked field
I am using jQuery.maskedInput-1.2.2.j s.
A DOB field is masked as below:
$('.dob').mask("??99/99/99 99");
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?
A DOB field is masked as below:
$('.dob').mask("??99/99/99
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you have a test page?
Or a jsfiddle.net?
Or a jsfiddle.net?
ASKER
I did the following changes:
<script type="text/javascript" src="template/js/jquery.js
<script type="text/javascript" src="template/js/jquery.in
<script type="text/javascript" src="template/js/jquery.in
Also changed the mask as below:
$('.dob').inputmask("mm/dd
But the problem still persists. Please advise.