• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

richValue in Validate

Community Beginner ,
Jun 29, 2023 Jun 29, 2023

Copy link to clipboard

Copied

Hi,
setting the value does not work in the "Validate" event. I have the field set correctly to richText, but even when I use event.richValue or event.target.richValue, the text still does not appear in the field. On Mouse events event.target.richValue works normally.
Here is my code:

// inputed in Validate
span1 = {text: "Hi, There!"};
event.richValue = [span1];
TOPICS
Acrobat SDK and JavaScript

Views

398

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2023 Jun 29, 2023

Copy link to clipboard

Copied

To apply a value you should use the Calculate event.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 29, 2023 Jun 29, 2023

Copy link to clipboard

Copied

I don't want to use Calculate, I want Validate.

Specifically, it doesn't work to insert a value if the field is empty.

if(event.richValue.length===0){
	span1 = {text: "Hi, There!"};
	event.richValue = [span1]
};

Here is my code:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2023 Jun 29, 2023

Copy link to clipboard

Copied

What are you trying to achieve here, exactly?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2023 Jun 29, 2023

Copy link to clipboard

Copied

LATEST

If you want to set the field's value to this text when it's empty just change the first line to:

if (event.value.length==0) {

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines