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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code does not see form changes

Status
Not open for further replies.

db96s1

Technical User
Feb 2, 2006
5
US
I downloaded a popup calendar that works quite nicely and feeds the calendar date selected into the start date field and with a separate call feeds end date field too. I want to populate seven check boxes (days of week) to reflect the start and end dates that were selected. I have tried triggering the function call at the body with onfocus="DowCheckBox_Fmt()" hoping hat as the form refained focus it would see the change and not what I expected, nothing. with the input start/end date using the onchange="DowCheckBox_Fmt()" the same thing is does not see the change. how do you get around this issue?


neither seems to see the new values that the calendar just populated. the code looks like this..
thanks in advance with this help.


<SCRIPT LANGUAGE="JavaScript">

function DowCheckBox_Fmt()
{
document.forms[0].Sunday.checked=false;
document.forms[0].Monday.checked=false;
document.forms[0].Tuesday.checked=false;
document.forms[0].Wednesday.checked=false;
document.forms[0].Thursday.checked=false;
document.forms[0].Friday.checked=false;
document.forms[0].Saturday.checked=false;

var MyStartDate = new Date() ;

<!-- it triggers manually but does not get new value --->
<!-- it does not get new value --->

MyStartDate.value = document.forms[0].StartDate.value ;

alert(MyStartDate);

var DOW_StartDate = MyStartDate.getDay();

alert(DOW_StartDate);


if (DOW_StartDate ==0)
{
document.forms[0].Sunday.checked=true;
}

if (DOW_StartDate ==1)
{
document.forms[0].Monday.checked=true;
}

if (DOW_StartDate ==2)
{
document.forms[0].Tuesday.checked=true;
}

if (DOW_StartDate ==3)
{
document.forms[0].Wednesday.checked=true;
}

if (DOW_StartDate ==4)
{
document.forms[0].Thursday.checked=true;
}

if (DOW_StartDate ==5)
{
document.forms[0].Friday.checked=true;
}

if (DOW_StartDate ==6)
{
document.forms[0].Saturday.checked=true;
}

}
</SCRIPT>
 
Make these changes:
Code:
var MyStartDate = new Date([!]document.forms[0].elements["StartDate"].value[/!]) ;

<!-- it triggers manually but does not get new value --->
<!-- it does not get new value --->

[s]MyStartDate.value = document.forms[0].StartDate.value ;[/s]

alert(MyStartDate);

-kaht

How much you wanna make a bet I can throw a football over them mountains?
sheepico.jpg
 
Thank You kaht! I was going bald on this one. May I impose on you for a js book referral?

Thanks again for this most excellent experience.

db96s1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top