Solved

Random population in jQuery masked field

Posted on 2012-12-31
3
624 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Master Content Pages, WebForms, and Session Variables 1 53
compact pure CSS Read More Toggle 4 152
Redirect Website for Mobile Devises 9 133
tag title an image 13 34
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

860 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