Expand my Community achievements bar.

SOLVED

Script issue on master page

Avatar

Level 10

So, I've got my little unique number generation script that I've posted on here before...it's on the Initialize event of the field.


if (this.rawValue == null) {
    var d = new Date();
    this.rawValue = parseInt(d / 1000);
}
else {
    this.rawValue = rawValue;
}

Which works fine if on the body of the form, but if I put it on the Master page it re-initializes (and changes the number) every time a subform gets shown/hidden. Any idea how to stop it from doing this? I've tried it on some other events without any luck.

I ran into another problem with this script, a field called "Date" was interfering with the script - throwing a "Date is not a constructor" error. Is this normal (function/field collision)?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Jono,

I have had issues scripting within the Master pages before. What I have done in the past is script a hidden textfield in the main pages with global binding (which has featured a lot here today); then same name textfield in Master page picks it up.

Good luck,

N.

Message was edited by: Niall O'Donovan

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Jono,

I have had issues scripting within the Master pages before. What I have done in the past is script a hidden textfield in the main pages with global binding (which has featured a lot here today); then same name textfield in Master page picks it up.

Good luck,

N.

Message was edited by: Niall O'Donovan