Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Fill two option fields with same date
mschwarz
Newbie

Posts: 1
Registered: 9/11/2006
Member Is Offline
posted on 9/11/2006 at 11:19 AM Reply With Quote
Fill two option fields with same date


I would like to fill a start date and end date with the same date. Then if the end date needs to be different the the start date, use a second instance of the picker to fill that field. (this already works.

This is what I have:

In the <b>head</> tag:
<!-- This line needed for calendar picker -->
<script language="JavaScript" src="calendar.js"></script>
<!-- End calendar picker -->

In the <b>body</b>:
<p><b>Start Date: </b>
<input name="startdate" type="text" size="15">
<a href="javascript:cal1.popup();"><img src="../../img/cal.gif" width="16" height="16" border="0" alt="Click to insert date using a picker."></a>
<b>End Date: </b>
<input name="enddate" type="text" size="15">
<a href="javascript:cal2.popup();"><img src="../../img/cal.gif" width="16" height="16" border="0" alt="Click to insert date using a picker."></a>

After the <b>form:</b>

<!-- Start code for calendar picker -->
<script language="JavaScript">

var cal1 = new calendar2(document.forms['NewItem'].elements['startdate']);
cal1.year_scroll = true;
cal1.time_comp = false;


var cal2 = new calendar2(document.forms['NewItem'].elements['enddate']);
cal2.year_scroll = true;
cal2.time_comp = false;
//-->
</script>
<!-- End code for calendar picker -->



I'm think the script needs something added to fill both the start date and end date with the date from the 1st picker.

Thanks in advance,
~Mark
View User's Profile View All Posts By User U2U Member
Chopenko
Junior Member

Posts: 9
Registered: 10/30/2007
Location: MA?xico
Member Is Offline
posted on 10/30/2007 at 11:52 PM Reply With Quote

Without modifications to the code, You have to set an "OnPropertyChange" event for your INPUT FIELD and then calling a function to copy the value from the original INPUT FIELD to the second FIELD.

<html>
<head>
<script language="JavaScript">
function MyCopyFunction(){
document.all.MyForm1.MyField2.value=document.all.MyForm1.MyField1.value;
}

</script>
</head>
<body>

<form name="MyForm1" method="post">

<input type="Text" name="MyField1" onPropertyChange="MyCopyFunction()">
<input type="Text" name="MyField2">

</form>

</body>
</html>
View User's Profile View All Posts By User U2U Member
moonchilddave
Junior Member

Posts: 4
Registered: 10/30/2007
Location: Leonardtown, MD
Member Is Offline
posted on 10/31/2007 at 08:14 PM Reply With Quote

This works in IE, but not in Firefox... anyone have any idea why? Or what can be done to make it work in both browsers?
View User's Profile View All Posts By User U2U Member
Chopenko
Junior Member

Posts: 9
Registered: 10/30/2007
Location: MA?xico
Member Is Offline
posted on 1/10/2008 at 01:55 AM Reply With Quote
Sorry


Hi moonchilddave, sorry for the late answer but I didn't even know I got a Message.
I saw this when another user replied to my other thread.

Well, I took that event code from a JavaScript on MSDN.
I was trying to use onChange event, but then i looked into a newer JavaScript reference documentation and found "OnPropertyChange".

Maybe you can search here, http://developer.mozilla.org/en/docs/JavaScript.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Free Download Free Download
Product Documentation Documentation
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004