Skip to main content
December 4, 2018
Answered

Save as button and can be pressed with the keyboard?

  • December 4, 2018
  • 1 reply
  • 1052 views

Hello there,

I'm new to Javascript on PDF forms but I wanted to insert a save as button on the end but here is the catch:
I'd like that button to be pressable with the keyboard, I mainly use tab key to go from field to field and once I get to the button I would like to be able o press space or enter to activate it and it'd open the save as pop up asking where I'd like to save the file already using the input of a field as the name for the file.
Is that even possible?

Thanks in advance,

Rafael Melo.

This topic has been closed for replies.
Correct answer try67

Sure. You can use a script to do it, or even with the built-in "Execute a Menu Item" command.

For the former, use this code:

app.execMenuItem("SaveAs");

this.print();

1 reply

try67
Community Expert
Community Expert
December 4, 2018

The space bar already does that... When you tab to a button field and press Space it triggers the MouseUp action.

It's not possible, however, to open the Save As dialog with a pre-populated value. You can display that value in a prompt window before, though, and request the user to use it as the new file-name.

December 4, 2018

Oh great, thanks for the tip.

Can I make the button have a regular "save as" function but also send a "print" command tho?

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 4, 2018

Sure. You can use a script to do it, or even with the built-in "Execute a Menu Item" command.

For the former, use this code:

app.execMenuItem("SaveAs");

this.print();