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

Dropdown List exporting a simplified link

New Here ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

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!)

TOPICS
How to , JavaScript , PDF forms

Views

14.3K

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

correct answers 1 Correct answer

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

...

Votes

Translate

Translate
Community Expert ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

You can't really create clickable text links with a script. You can set the entire text field (or button, or link object) to act as a link when clicked, but not parts of it.

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
New Here ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

So that means if my export value for a particular dropdown selection was:

https://community.adobe.com/t5/acrobat-discussions/dropdown-list-exporting-a-simplified-link/m-p/134...

 

... there's no way for it to show up in the text field as a clickable link that says "Exporting a simplified link"?

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 ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

You can create a link that shows that text and opens a URL when clicked, sure.

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
New Here ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

Can I do that for the export value of a drop down list?

 

So, in my dropdown, I would have an item that shows up to the user as "Adobe forum response"

but the export value is: my big long link - https://community.adobe.com/t5/acrobat-discussions/dropdown-list-exporting-a-simplified-link/m-p/134...

 

But in the text field that retrieves that export value I don't want it to have that massively long link, I want it to just say "Exporting a simplified link" with that being a clickable link to the full-length URL.

 

The other idea I had was to simplify the urls that I need to put in using bit.ly or tinyurl, but that would be my second choice, by far.  

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 ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

Hi,

If you are interested, we can directly launch the web page from the selection of the drop-down menu with a custom keystroke script.

if (!event.willCommit) {
	if (event.changeEx!="0") app.launchURL(event.changeEx);
}

 @+

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
New Here ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

No, that's not really what I want.  This form is so that users (teachers) can choose from a long list of potential tests, one that they gave to their student - the form would then populate the grade-level standard score, passing score, or alternatively, a link to a score table that a potential auditor could then go to, comparing the student's score to the grade-level standard.  So there really needs to be a clickable or copy-able link exported to a separate column of the table so that the final viewer of the document (the potential auditor) would be able to go to the test publisher's cut-score table and compare the student's score to the grade-level standard. I could probably make the form spit out different standard scores from chosen tests based on a student's grade level, but that's a lot more work than I want to go to.  

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 ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

...but if the text field only contains the short simplified link ("Adobe forum response" for example), you could replace it by a clickable button! So, the custom keystroke script of the drop-down menu would be:

if (!event.willCommit) {
	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)) {
				this.getField("theButton").buttonSetCaption(f.getItemAt(i,false));
				break;
			}
		}
		this.getField("theButton").setAction("MouseUp", "app.launchURL(\""+event.changeEx+"\",true);");
	} else {
		this.getField("theButton").buttonSetCaption("");
		this.getField("theButton").setAction("MouseUp", "app.beep(0);");
	}
}

Have a look on my example.

@+

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
New Here ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

You're being super helpful!  Thank you! 

 

This is getting really close to what I want (sure wish I could understand it - don't use it enough to bother taking a class; I'd just forget everything).  Problem being that some of the export values will not be links - some will just be numbers or text, so those would have to be visible in place of the button, or at least nearby the button.  Any ideas?

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 ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

So, try this new script:

 

if (!event.willCommit) {
	this.getField("theButton").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("http")==0) {
					this.getField("theButton").setAction("MouseUp", "app.launchURL(\""+event.changeEx+"\",true);");
					this.getField("theButton").buttonSetCaption(f.getItemAt(i,false));
				} else this.getField("theButton").buttonSetCaption(f.getItemAt(i,true));
				break;
			}
		}
	} else this.getField("theButton").buttonSetCaption("");
}

 

...and let me know if that suits to you!

@+

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
New Here ,
Jan 15, 2023 Jan 15, 2023

Copy link to clipboard

Copied

Okay, really close, now!  Problem still is that I need to combine two operations.  For those items that open a web link, I also need to tell the auditor what the standard score is. 

 

For example: One of my dropdown items is Acadience Reading - the standard score is "At or above Benchmark" which I want to be visible as the export value, and I want the auditor to be able to click a link to open the site: https://acadiencelearning.org/wp-content/uploads/2021/11/Acadience-Reading-K-6-Benchmark-Goals-hando...

 

I'm guessing that there's not going to be a way to do what I want with this and that I'm going to have to go to the extra effort of adding a separate grade-level field that would then control what numbers are output for each selected assessment - if that's the case, I'll need help on that, too, and I'll start a new post since it would be a different operation - let me know!

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 ,
Jan 15, 2023 Jan 15, 2023

Copy link to clipboard

Copied

Hi,

Sorry but I don't understand this time...

Is it possible you share an example?

@+

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
New Here ,
Jan 19, 2023 Jan 19, 2023

Copy link to clipboard

Copied

I can't really share an example file, but I can describe what I want it to do (and like I said; I think it's probably not possible).  

 

I want the exported value to act like an embedded link in an email or here in this message.  

 

I want my export for the dropdown selection of "Acadience Reading" to be: At or Above Benchmark - click for score table - where the link is embedded within the displayed text.

 

 

 

If not possible, then I've got another solution in mind where I wouldn't use any links at all, but where I would need to have two additional form fields / drop downs - one for grade level, and one for the time of year; the selection in these fields would then need to control the population of the dropdown list I've been working on - if that's possible.  For example: if a user were to select 1st grade at the beginning of the year (BOY), then the export value for Acadience Reading would be 113 or higher, whereas, if they selected 1st grade at the end of the year (EOY), then the export value for Acadience reading would be 155 or higher. 

 

If I have to go this second route, then I'll create a new thread since it's a very different operation.

 

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 ,
Jan 23, 2023 Jan 23, 2023

Copy link to clipboard

Copied

Hi,

It is not possible to create clickable text links with a script. According to your form, we could (maybe) simulate that but it's impossible without seeing it!

@+

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
New Here ,
Jan 23, 2023 Jan 23, 2023

Copy link to clipboard

Copied

Okay, here you go!  This is the roughest of drafts at the moment, so if there's anything that should be changed visually to make this work, that's fine.  

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 ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

Thank, let me think...

That could take a few days because I'm vey busy at the moment...

@+

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 ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

do you have several url to indicate or only this one?

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
New Here ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

As of now we have five different URLs that might be indicated.  Two or three are very likely to be selected on the same form.

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 ,
Jan 25, 2023 Jan 25, 2023

Copy link to clipboard

Copied

Hi,

Try the attached example and let me know if this is what do you expect!

If yes, I'll give more explanation.

@+

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
New Here ,
Jan 25, 2023 Jan 25, 2023

Copy link to clipboard

Copied

Yes!  That worked perfectly!  I explored the form and saw what you did, and think I understand part of it.  You stacked everything together into that third column so that the button with the link is clickable and the corresponding text is visible.  I tried adding another option with a link, but I unfortunately wasn't able to follow your lead well enough to make it work.  Please help me out with that explanation!

 

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 ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

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-recta...

I hope the explanation will allow you to add an other item yourself...

@+

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
New Here ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Yes, I've got it all working pretty much as I want it, and just sent it in to my lead so she can take a look at it.  Now I just have to wait for our committee to finalize selection of possible BOE sources and I can finish the form.  

 

You've been amazingly helpful!

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
New Here ,
Mar 10, 2023 Mar 10, 2023

Copy link to clipboard

Copied

Okay, it's been a while since I've posted on this thread: I ran out of my assessment time when I can work on this stuff while kids are testing, and had to go back to actual teaching!  At any rate, it's Spring Break now, so I'm back to it.  I've found a small problem with the form.  When I clear the form so that it's blank to begin with, the most recently populated link is still in the far right column and clickable, even though it is not visible.  When I mouse-enter any of those spaces in that column, the text pops up, even though I haven't made a selection from the assessment drop down.  If the previous assessment I chose (before clearning the form) was not one with a clickable link, then the export value text in the far right column will remain even when I clear the form. I need a way to have that far right column clear until I actually choose an assessment from the drop down.  I tried editing the Actions in "theLink", and removed the mouse enter and mouse exit actions, which made it so that the cleared text wouldn't pop up, but the actual link itself was still there and clickable.  I'm attaching two files, v.1.1 with the mouse enter/exit still there, and v1.2 with that removed.

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 ,
Mar 11, 2023 Mar 11, 2023

Copy link to clipboard

Copied

Hi,

A small modification at the end of the script of the function should be enough:

...
		}
	} else {
		this.getField("Standard_score"+ind).buttonSetCaption("");
		this.getField("theText"+ind).value="";
	}
}

@+

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
New Here ,
Mar 11, 2023 Mar 11, 2023

Copy link to clipboard

Copied

Remember that I'm a novice when it comes to scripting. Do I add this to the actions in "the Link" or to the document level Javascript? If the latter, do I just paste it into the very bottom? 

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