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

List Box Multiple Selection, Selecting Value to Enable Text Field

Community Beginner ,
Oct 09, 2022 Oct 09, 2022

Hello 🙂   I'm looking for some help on trying to fullfill this requirement I'm working with, I'm not sure if this is doable though or not.

I have a List Box with multiple selections enabled. One of the fields that can be selected is called "Other". If Other is selected, then a text field underneath the List Box should be set to read only false (user can enter input). If the Other option is deselected, the text box should go back to read only.

I've noticed that in the List box options it doesn't appear that you can select both "Multiple selection" and "Commit selected value immediately". This makes me think this might not be possible since I was under the assumption the Commit selected value immediately option needs to be checked for this to work properly, but if it is I'd like to know what the approach is. I'm assuming the script will be under List Box Selection Change -> Execute this Script -> code to check if list box array has Other selected. I'd appreciate the help and I attached a Test PDF to show what I mean. Thanks,

Daniel

TOPICS
Create PDFs , How to , JavaScript , PDF forms
1.3K
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 09, 2022 Oct 09, 2022

It is possible, but it will only update once you exit the field.

You can do it using this code as the custom calculation script of the OtherBox text field:

 

var list = this.getField("ListBox1").value;
if ((typeof list=="object" && list.indexOf("Other")!=-1) || (typeof list=="string" && list=="Other")) {
	event.target.readonly = false;
} else {
	event.target.readonly = true;
	event.value = "";
}

View solution in original post

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 ,
Oct 09, 2022 Oct 09, 2022

It is possible, but it will only update once you exit the field.

You can do it using this code as the custom calculation script of the OtherBox text field:

 

var list = this.getField("ListBox1").value;
if ((typeof list=="object" && list.indexOf("Other")!=-1) || (typeof list=="string" && list=="Other")) {
	event.target.readonly = false;
} else {
	event.target.readonly = true;
	event.value = "";
}
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 ,
Oct 10, 2022 Oct 10, 2022
LATEST

Thank you! This was very helpful.

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