Copy link to clipboard
Copied
I am creating a recipe pdf file and I have created a dropdown list to allow a user to select the type of recipe to fill the in the dropdown text box ie; main course, dessert, appetizer and so on.
My question is if in the dropdown list I check the opiton to "allow user to enter custom text" and the user enters a text such as "pasta", can that text be saved in the dropdown list after the user has entered the text?
I have tried different ways but the text is never saved into the dropdown list.
Thanks for your help.
Copy link to clipboard
Copied
Hi @wislndixie
Thanks for reaching out.
If you are following all the steps as it is and the "Allow user to enter the custom text" dialog is checked under the properties, then it should work.
Have you tried working on it at your end, can you enter the custom text? How the users have been opening the form, it also depends on that.
We have a similar discussion here, where this issue has been addressed and resolved. Please have a look
Thanks,
Akanchha
Copy link to clipboard
Copied
++Adding to the topic,
If you will enable the option for users to type in the name of a desired item in a combobox, and add that item into the existing list, you must employ a JavaScript script. In which case, you'll also need to provide the ability for the user to delete the new entries if they are mispelled or have errors after they hit enter, for example. Otherwise the list will display a bunch of unnecessary added items (making it a mess).
The best way to do this is to create a predefined list of recipe names that will remain always available and append the new added items to the end of that pre-defined list.
Would you be able to share an example of your PDF?
Copy link to clipboard
Copied
Hi,
Here is an On Blur Action script:
var theList=[];
for (var i=0; i<event.target.numItems; i++) theList.push(event.target.getItemAt(i))
var found=0;
for (var i=0; i<theList.length; i++) {
if (theList[i]==event.value) {
found++;
break;
}
}
if (!found) {
theList.push(event.value);
event.target.setItems(theList);
event.target.value=event.value;
}
@+
Copy link to clipboard
Copied
...and as ls_rbls mentioned, if you add the ability to add an item you must add the ability to remove it:
var theList=[];
for (var i=0; i<event.target.numItems; i++) theList.push(event.target.getItemAt(i))
if (this.getField("chkBox").value=="Off") {
var found=0;
for (var i=0; i<theList.length; i++) {
if (theList[i]==event.value) {
found++;
break;
}
}
if (!found) {
theList.push(event.value);
event.target.setItems(theList);
event.target.value=event.value;
}
} else {
for (var i=0; i<theList.length; i++) {
if (theList[i]==event.value && i!=0) {
theList.splice(i, 1);
this.getField("chkBox").value="Off";
break;
}
}
event.target.setItems(theList);
}
@+
Copy link to clipboard
Copied
Easiest way is to copy/paste what you want to show in the drop down list then ADD (like you would for a new item) to the drop down list. however, I do not know how many characters will be allowed in a drop down list.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now