Solved

Random population in jQuery masked field

Posted on 2012-12-31
3
590 Views
Last Modified: 2013-01-02
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
Comment
Question by:somaghoshCU
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 300 total points
ID: 38734004
0
 

Author Comment

by:somaghoshCU
ID: 38736862
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38736945
Do you have a test page?

Or a jsfiddle.net?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now