?
Solved

Random population in jQuery masked field

Posted on 2012-12-31
3
Medium Priority
?
656 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 1200 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

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

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

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

764 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