Copy link to clipboard
Copied
Hi! I'm creating a purchase request form for my department. This form has a dropdown menu with different department accounts/numbers listed for them to choose from. On the dropdown, the text is formatted as-
[ACCOUNT #] - [ACCOUNT NAME]
-and I have the account number as the export value. I currently have the below custom format script so that when the account number/name is selected, only the account number (listed as the export value) will populate:
event.value = event.target.getItemAt(event.target.currentValueIndices, true);
My problem is, that I also want to be able to insert custom text in addition to the dropdown options. When I currently try to enter custom text, it auto populates the closest account number listed in the dropdown, despite having the custom text option clicked. I understand this is likely due to the custom format script. Is there anything I can add to the script that will also allow custom text to be entered?
Thanks!
Copy link to clipboard
Copied
Use this code:
if (event.target.currentValueIndices>=0) event.value = event.target.getItemAt(event.target.currentValueIndices, true);
Copy link to clipboard
Copied
Use this code:
if (event.target.currentValueIndices>=0) event.value = event.target.getItemAt(event.target.currentValueIndices, true);
Copy link to clipboard
Copied
Thank you!! That works! 🙂
One more question:
Based on someone's choice on the Account # dropdown, another field will autopoplate with corresponding numbers for that account. This is the custom calculation script I have for that text box:
var v = this.getField("FUND").valueAsString;
if (v == "######") {
event.value = "######";
} else if (v == "######") {
event.value = "######";
} else {
event.value = "";
}
My issue with this is, I also would like for users to be able to enter custom text into this field as well, but currently it automatically makes any text entered blank. Any ideas?
Thanks!
Copy link to clipboard
Copied
Actually, nevermind, I think I was able to use the same code as my "else" on the text box as well!!

