Expand my Community achievements bar.

SOLVED

Script change for rich text use

Avatar

Level 9

I am using the script below to add user instructions to Textfields. I would like to do the same thing with textfields formatted for rich text but this script stops working when i set the field to accept rich text. Can you tell me how to modify the script so it will work in a ttext field that will allow the user to enter rich text?

MeetingMinutes.#subform[2].Attendees::initialize - (JavaScript, client)

this.execEvent("exit");
this.format.picture.value = "null{'" + this.assist.toolTip.value + "'}";


MeetingMinutes.#subform[2].Attendees::enter - (JavaScript, client)

this.fontColor = "0,0,0";
this.font.posture = "normal";


MeetingMinutes.#subform[2].Attendees::exit - (JavaScript, client)

if (this.isNull)
{
this.fontColor = "153,153,153";
this.font.posture = "italic";
}


MeetingMinutes.#subform[2].Attendees::prePrint - (JavaScript, client)

this.format.picture.value = "";


MeetingMinutes.#subform[2].Attendees::postPrint - (JavaScript, client)

this.format.picture.value = "null{'" + this.assist.toolTip.value + "'}";

Thank you,

-Don

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Don,

Similar to your script above, but try this in the enter event:

if (this.rawValue === this.assist.toolTip.value) {

          this.rawValue = "";

}

and then this on the exit event:

if (this.rawValue === null) {

          this.rawValue = this.assist.toolTip.value;

}

Alter to suit formatting and initialize event, etc.

Niall

View solution in original post

6 Replies

Avatar

Level 10

Hi Don,

I don't think that you will be able to get this working with a rich text field. The Object > Field Patterns is disabled and implementing it within the XML Source wont work:

Parallels Desktop1.png

I suspect that this is because the text field has an exData one of child property when rich text is turned on.

It is one or the other (rich text field OR null patterns).

Good luck,

Niall

Avatar

Level 9

Is there any script or way to add user instructions that will be automatically deleted when the surer enters that field? Currently, users are leaving the instruction in the field which is confusing when you receive the form.

Thanks for your reply.

-Don

Avatar

Correct answer by
Level 10

Hi Don,

Similar to your script above, but try this in the enter event:

if (this.rawValue === this.assist.toolTip.value) {

          this.rawValue = "";

}

and then this on the exit event:

if (this.rawValue === null) {

          this.rawValue = this.assist.toolTip.value;

}

Alter to suit formatting and initialize event, etc.

Niall

Avatar

Level 9

I left off part of my question. Will the script suggestion you added work if dormatted for rich text? I need to keep that field as rich text.

Thanks so much for your help Niall.

-Don

Avatar

Level 10

Hi Don, the above works with a rich text field...

Niall

Avatar

Level 9

I added the script that you sent to what i already had and set the textfield to rich text. So far, everything seems to work correctly.

Thank you so much for your help.

-Don