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

Text field (Forms) - highlighting the text after choosing (pressing) of the form

Community Beginner ,
Jul 18, 2022 Jul 18, 2022

Dear members,

 

I hope that someone will be able to help me.

 

I have created a fillabile pdf file.

 

The file contain checkboxes and also text fileds.

 

Is there any ready script with which i can highlight one of few offered text fields (or words) when i will press on one of them.

 

For instance in the pdf i have one row with this question:

 

You eat with: a spoon - a fork  - a knife

Is there a way when i will press on one of the words (spoon or fork or knife)  that word to be automaticaly highlighted with some specific color ?

 

Thanks in advance

TOPICS
How to , PDF forms
813
Translate
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 ,
Jul 19, 2022 Jul 19, 2022

Not really. First of it, it's extremely difficult finding out exactly on which word the user clicked, and also there's no way to highlight a part of a text in a form field. You can, however, change a word's text color, or underline it, for example.

Translate
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 ,
Jul 19, 2022 Jul 19, 2022

Thank you very much for your fast reply. Could you send me a script for your proposal ?thanks 

Translate
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 ,
Jul 19, 2022 Jul 19, 2022

Which part?

Translate
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 ,
Jul 19, 2022 Jul 19, 2022

I mean on this ...You can, however, change a word's text color, or underline it, for example.

Translate
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 ,
Jul 19, 2022 Jul 19, 2022

This requires setting the field as having Rich Text Formatting, and then applying the value to it using the richValue property as an array of Span objects, like this:

 

var spans = [];
var span1 = new Object();
span1.text = "a spoon - ";
spans.push(span1);
var span2 = new Object();
span2.text = "a fork";
span2.underline = true;
spans.push(span2);
var span3 = new Object();
span3.text = "  - a knife";
spans.push(span3);

this.getField("Text1").richValue = spans;

 

 

Translate
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 ,
Jul 19, 2022 Jul 19, 2022
LATEST

many, many thanks

Translate
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