Solved

time validation

Posted on 2014-03-28
6
324 Views
Last Modified: 2014-03-28
Hi,

I have two fields first one is Date identified and the second is time occurred
I want to say if Date Identified has a value then Time occurred is required.

this is what I have that is not working.

Thanks,
Lulu

<INPUT style="TEXT-ALIGN: center; WIDTH: 175px; HEIGHT: 23px" id=DateIdentifiedtxt value=03/28/2014 name=DateIdentifiedtxt data-format="MM/dd/yyyy" jQuery110205894598305599419="43">
</INPUT >


<INPUT style="TEXT-ALIGN: center; WIDTH: 165px; HEIGHT: 23px" value=00:00:00 name=TimeOccurredTxt data-format="hh:mm:ss" jQuery110205894598305599419="62">
</INPUT >


function ValidateForm()
{
	var DateIdentified = $("#DateIdentifiedtxt").val();
	var TimeOccurred = $("#TimeOccurredTxt").val();
	
	if (DateIdentified != "" && (TimeOccurred === null || TimeOccurred === undefined || 
	TimeOccurred === '00:00:00'))
	{		
		alert("Time Occurred is required");
		return false;
	}
}

Open in new window

0
Comment
Question by:lulu50
  • 3
  • 2
6 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39962018
you should try to validate your HTML first : http://validator.w3.org/
0
 

Author Comment

by:lulu50
ID: 39962047
not sure what you mean by that

What is that link for? lol lol don't know what to do with it lol lol
ah I'm glad it's Friday.
0
 
LVL 2

Accepted Solution

by:
GowthamNatarajan earned 500 total points
ID: 39962254
Try this...

<INPUT style="TEXT-ALIGN: center; WIDTH: 175px; HEIGHT: 23px" id=DateIdentifiedtxt value=03/28/2014 name=DateIdentifiedtxt data-format="MM/dd/yyyy" jQuery110205894598305599419="43" onblur="return ValidateForm()">
</INPUT >


<INPUT style="TEXT-ALIGN: center; WIDTH: 165px; HEIGHT: 23px" value=00:00:00 id=TimeOccurredTxt name=TimeOccurredTxt data-format="hh:mm:ss" jQuery110205894598305599419="62" onblur="return ValidateForm()">
</INPUT >

function ValidateForm() {
            var DateIdentified = $("#DateIdentifiedtxt").val();
            var TimeOccurred = $("#TimeOccurredTxt").val();
            alert(DateIdentified + "--" + TimeOccurred);
            if (DateIdentified != "" && (TimeOccurred === null || TimeOccurred === undefined ||
            TimeOccurred === '00:00:00')) {
                alert("Time Occurred is required");
                return false;
            }
        }
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 82

Expert Comment

by:leakim971
ID: 39962262
What is that link for? lol lol don't know what to do with it

Put URL of your web page in the address field
0
 

Author Comment

by:lulu50
ID: 39962282
GowthamNatarajan,

When I put in a real time, it tells me that the time field is undefined.

not sure why
0
 

Author Closing Comment

by:lulu50
ID: 39962441
Thank you
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 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

14 Experts available now in Live!

Get 1:1 Help Now