troubleshooting Question

select dynamic textbox data

Avatar of CCSOFlag
CCSOFlagFlag for United States of America asked on
JavaScriptHTMLWeb Components
9 Comments3 Solutions505 ViewsLast Modified:
This is probably something simple I am missing.  I'm trying to create a validation checker for multiple elements.  I want to pass the element name into the function in javascript and if it doesn't pass the validation I want it to focus on the element and highlight the data in the element that is incorrect.  I want this done either onblur or onchange.

I haven't included all of the functions because the rest of it works.  In the javascript function the alert fires, but the focus and select do not.  it leaves the focus on the next element if you tab out or whatever element you click on next.
function ValidateDate(varID)
alert('Please input a proper date with slashes');
var MyTextBox = document.getElementById(varID);
///I've also tried this:
alert('Please input a proper date with slashes');
<form id="AddNewEmployeeform" >
    <input class="required" type="text" id="DateOfBirthTxt" name="DateOfBirthText" size="10" onchange="ValidateDate('DateOfBirthTxt');" />
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 3 Answers and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros