Auto Fill (Editable) Text Prompt
By Iain Anderson @Iain_Anderson
Hi there,
I'm working on a script that will prompt the user for input but will auto fill with the output of another function in the script.
Is there some clever code to make a popupText box auto fill with data from a variable? I'd also like to be able to edit that auto fill data before confirming entry.
var adrLine = sf.interaction.popupText({
title: 'ADR Line'
}).text;
Many thanks,
Iain

- Raphael Sepulveda @raphaelsepulveda2023-08-08 15:48:54.531Z
@Iain_Anderson, to be able to edit an auto-filled string in a prompt I suggest using
displayDialog
.Here's a simple example:
function getAdr() { return "ADR Line" } const adr = getAdr(); const adrLine = sf.interaction.displayDialog({ prompt: "Enter ADR Line", defaultAnswer: adr, // This is the auto-fill }).text
Alternatively, you can pass the function directly to
popupText
if it makes sense to do so in the context of your script:function getAdr() { return "ADR Line" } const adrLine = sf.interaction.displayDialog({ prompt: "Enter ADR Line", defaultAnswer: getAdr(), }).text
Hope that helps!
- IIn reply toIain_Anderson⬆:Iain Anderson @Iain_Anderson
Awesome work. Love it. Thanks!