Solved

time validation

Posted on 2014-03-28
6
323 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
Comment Utility
you should try to validate your HTML first : http://validator.w3.org/
0
 

Author Comment

by:lulu50
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 82

Expert Comment

by:leakim971
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
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…

763 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

11 Experts available now in Live!

Get 1:1 Help Now