• Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Spezielle Community für Japanischsprachige
  • 한국 커뮤니티
    Spezielle Community für Koreanischsprachige
Beenden

Dropdown List exporting a simplified link

Neu hier ,
Jan 13, 2023 Jan 13, 2023

Link in Zwischenablage kopieren

Kopiert

I'm making a form with a dropdown list that exports a variety of values based on user selection.  Some of those values need to be web links; however, I would prefer they were not visible as the whole link, but rather as links embedded within text.  Is that possible, and if so, how would I do it? 

 

(Be aware, my knowledge of Javascript is pretty basic, but I'm good at copy/paste and I can change field names!)

THEMEN
Anleitungen , JavaScript , PDF Forms

Zugriffe

15.6K

Übersetzen

Übersetzen

Melden

Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines

correct answers 1 richtige Antwort

Community Expert , Jan 26, 2023 Jan 26, 2023

Hi,

If you wish add an item with an url in your dropdown menu

Capture d’écran 2023-01-26 à 16.32.00.png

you have to add it with an export value starting with link... (link2, link3...)

Capture d’écran 2023-01-26 à 16.32.25.png

then you have to modify the init script in document-level

Capture d’écran 2023-01-26 à 16.33.44.png

and define the link... object with the text, the url and the text size.

Capture_d’écran_2023-01-26_à_16_33_15.png

Try with the link3 object...

FYI, as it is not possible to use the auto size in a rich text field, you will have to set the size manually indicating it in the link object.

https://community.adobe.com/t5/acrobat-discussions/all-text-data-to-fit-in-a-rich-text-field-s-rectangle/m-p/13526601#M396185

...

Stimmen

Übersetzen

Übersetzen
Community Expert ,
Mar 11, 2023 Mar 11, 2023

Link in Zwischenablage kopieren

Kopiert

To the document-level script!

But have a look on the file of my previous answer, the script of the function has been updated.

Else:

function gradeLevelStandardScoreOrLink(ind) {
	try {
		this.removeField("theText"+ind);
		this.removeField("theLink"+ind);
	} catch(e) {}
	this.getField("Standard_score"+ind).display=display.visible;
	this.getField("Standard_score"+ind).setAction("MouseUp", "app.beep(0);");
	if (event.changeEx!="0") {
		var f=this.getField(event.target.name);
		for (var i=0; i<f.numItems; i++) {
			if (event.changeEx==f.getItemAt(i,true)) {
				if (event.changeEx.indexOf("link")==0) {
					var coord=this.getField("Standard_score"+ind).rect;
					this.getField("Standard_score"+ind).display=display.hidden;
					var f=this.addField("theText"+ind, "text", 0, coord);
					f.richText=true;
					f.readonly=true;
					spans=[{
						text: eval("allLinks."+event.changeEx+".theText"),
						textColor: color.blue,
						textSize: eval("allLinks."+event.changeEx+".theSize"),
						underline: true,
					}];
					f.richValue=spans;
					var f=this.addField("theLink"+ind, "button", 0, coord);
					f.setAction("MouseUp","app.launchURL(\""+eval("allLinks."+event.changeEx+".theURL")+"\",true);");
					f.setAction("MouseEnter","spans=[{text: \""+eval("allLinks."+event.changeEx+".theText")+"\",textColor: color.red,textSize: "+eval("allLinks."+event.changeEx+".theSize")+",underline: true,}];this.getField(\"theText"+ind+"\").richValue=spans;");
					f.setAction("MouseExit","spans=[{text: \""+eval("allLinks."+event.changeEx+".theText")+"\",textColor: color.blue,textSize: "+eval("allLinks."+event.changeEx+".theSize")+",underline: true,}];this.getField(\"theText"+ind+"\").richValue=spans;");
				} else this.getField("Standard_score"+ind).buttonSetCaption(f.getItemAt(i,true));
				break;
			}
		}
	} else {
		this.getField("Standard_score"+ind).buttonSetCaption("");
		this.getField("theText"+ind).value="";
	}
}

@+

Stimmen

Übersetzen

Übersetzen

Melden

Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Neu hier ,
Mar 13, 2023 Mar 13, 2023

Link in Zwischenablage kopieren

Kopiert

Huh.  Still didn't work.  I'm attaching the updated form.  I added a form reset button, and you can see that where I've made selections from the assessment dropdown, if it was a link, the reset button will remove the text, but when you mouse-enter, that reappears.  If I select an assessement from the dropdown that only exports text, that will not clear at all.  Thank you again!

Stimmen

Übersetzen

Übersetzen

Melden

Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Mar 13, 2023 Mar 13, 2023

Link in Zwischenablage kopieren

Kopiert

That's because you hard-coded the text into the code. Instead of doing that you should read the field's current contents, and then change their color, if it's not blank.

Stimmen

Übersetzen

Übersetzen

Melden

Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Mar 19, 2023 Mar 19, 2023

Link in Zwischenablage kopieren

Kopiert

Hi,

Here is your file where I modifyed a bit the script and I place a script in your Clear button.

for (var i=1; i<=9; i++) {
	this.removeField("theText"+i);
	this.removeField("theLink"+i);
	this.getField("Standard_score"+i).display=display.hidden;
}
this.resetForm();

Concerning the function script, I removed the "try" statment for removing the fields.

In the previous script, I placed "removeField" with "try" statment in the case these fields don't exist but that doesn't work... That only works without the "try" statment and there is no error message if the field doesn't exist... I don't know why!

@+

Stimmen

Übersetzen

Übersetzen

Melden

Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Mar 19, 2023 Mar 19, 2023

Link in Zwischenablage kopieren

Kopiert

Because removeField doesn't throw an Exception if the field name you supply to it doesn't exist. It doesn't return any values, either.

Stimmen

Übersetzen

Übersetzen

Melden

Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Mar 19, 2023 Mar 19, 2023

Link in Zwischenablage kopieren

Kopiert

AKTUELL

That's what I noticed, thanks!

@+

Stimmen

Übersetzen

Übersetzen

Melden

Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines