This topic is locked

timestamp on menu change

2/27/2008 3:58:10 PM
ASPRunnerPro General questions
M
mfred author

In edit, there is a field called 'JobLocation'. This is a lookup menu. We want a timestamp to occur where a field called 'DelTransferTime' has the date/time entered when 'Delivery' is selected in the 'JobLocation' menu. Thanks in advance for any assistance.

J
Jane 2/28/2008

Hi,
use JavaScript code for that.

Here is a sample:

{literal}<script>

d = new Date();

document.forms.editform.value_JobLocation.onchange=function()

{

if (document.forms.editform.value_JobLocation.value=="Delivery")

document.forms.editform.value_DelTransferTime.value=d;

}

</script>{/literal}



To add JavaScript code proceed to the Visual Editor and turn on HTML mode.

M
mfred author 3/3/2008

Where is the sample code entered?

Sergey Kornilov admin 3/4/2008

To add this JavaScript code proceed to the Visual Editor, open Add/Edit page, switch to HTML mode and paste the code at the end of page.

M
mfred author 3/4/2008

It's not quite working. I added the code as noted. If I don't have DelTransferTime as an active field on the form, then I get a browser error that says 'Document.forms.editform.value_DelTransferTime' is null or not an object. The form will submit but DelTransferTime is not updated. If I include DelTransferTime as an active field on the form, then I don't get an error but the field still does not get updated. Thanks for helping with this.