...

View Full Version : Updating a form value



probi
05-27-2012, 06:42 PM
Hi All,

I have a popup calendar that I want a user to be able to click a date and for it to update a field on the previous page.

I've tried the following code:


<SCRIPT LANGUAGE="JavaScript">
function updateDate(){
window.opener.document.getElementById(startdate).value = "12/05/12";
self.close();
return false;
}
</SCRIPT>


but when clicking on the date nothing at all happens.

I'm trying to get it so that any part of the DIV can be clicked on and the field I want to update is startdate, the code I'm using inside my DIV tag is


onclick="updateDate()"


I'm very new to javascript so probably doing something very stupid!

Thanks in advance

Philip M
05-27-2012, 06:48 PM
window.opener.document.getElementById("startdate").value = "12/05/12";If "startdate" is the id of a field then then is a literal which must be in quotes.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

probi
05-27-2012, 06:53 PM
I knew it would be something stupid!!

Thanks very much



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum