Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onblur DateTime Picker

Status
Not open for further replies.

jennuhw

MIS
Apr 18, 2001
426
US
I am using Microsoft's datetime picker. I have a beginning and end date. I want the end date to equal the beginning date if the beginning date has changed.
I tried onchange event, but it never fired off. I changed this to the onblur which works, kinda. If you use the mouse to change the date then click on the end date or type in the new beginnning date and click on any other field, it works great. The problem is if you click to choose a new date in the beginning field, and click anywhere but the corresponding end date field, it won't change the end date. Thanks!

Code:
<script language = "javascript">
	function changeDate(dateField)
		{
		var lastField = "Date" + dateField + "end";
		var firstField = "Date" + dateField;

		document.getElementById(lastField).value = document.getElementById(firstField).value;
		}
</script>

<%for x = 1 to 5%>
					<tr><td><object id="Date<%=x%>" name="Date<%=x%>" width="83" height="23" classid="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1" onblur="changeDate(<%=x%>)"></object></td>

					<td><object id="Date<%=x%>end" name="Date<%=x%>end" width="83" height="23" classid="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1"></object></td>

					<td><input type="text" name="Hours<%=x%>" size = 3 maxlength=4></td>
					</tr>
			<%next%>
 
Unless the date time picker has an onchange event, you won't be able to use it. This isn't really a JS-specific question - I'd ask in a forum more relevant to the control itself, or read the docs for the control.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks. I wasn't really sure if it was a java problem or not. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top