Problem with Date() in a label?

As far as I can see (JavaScript Noowbie of course …) the code below should return the date in the form element. Instead I get an error

var get_date = Date();
forms.rpt_component_detail.elements.lbl_todays_date = get_date;
or
var get_date = new Date();
forms.rpt_component_detail.elements.lbl_todays_date = get_date;

Error: Can’t put in a locked scope, name: lbl_date, value: org.mozilla.javascript.NativeDate@d5921

I’m obviously missing something here - appreciate feedback.

Cheers

You have to set the text-property of your label instead of the label itself:

var get_date = new Date();
forms.rpt_component_detail.elements.lbl_todays_date.text = get_date;

Joas:
You have to set the text-property of your label instead of the label itself:

var get_date = new Date();

forms.rpt_component_detail.elements.lbl_todays_date.text = get_date;

Doh - I knew that Joas :oops:

Thanks for the quick feedback.