Skip to main content
Participating Frequently
July 2, 2017
Question

Clear fields after pressing button

  • July 2, 2017
  • 4 replies
  • 2934 views

Hello, i have a form with a email button. Is it possible when they hit the email button its clears all form fields. Because when some one else use the form they can start with a blank form.

I already tried  the : this.resetForm(["P1.OrderForm.REVISIE","P1.OrderForm.OMSCHRIJVING TEKENING"]); javascript in the button field. But it doesn't work.

What is wrong?

This topic has been closed for replies.

4 replies

JR Boulay
Community Expert
Community Expert
July 3, 2017

I don't think it's a good idea to reset the form like that…

I agree.

sjefd38453562 do not be surprised if a user comes to you with a gun in his hand !

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
Community Expert
July 2, 2017

What can i do to send first the email and then clear the form?

Add:

this.resetForm();

this.dirty = false;

In the document action : When document will be closed.

So the user will not be prompted to save when closing the (resetted) form.

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
Community Expert
July 2, 2017

Is it possible when they hit the email button its clears all form fields?

Yes, but this will send a blank form…

Acrobate du PDF, InDesigner et Photoshopographe
Participating Frequently
July 2, 2017

JR_Boulay you are right. i forget to check my forms. What can i do to send first the email and then clear the form?

try67
Community Expert
Community Expert
July 2, 2017

Just change the order of the commands... First Submit Form, then Execute JavaScript. You can also use the built-in Reset Form command, by the way.

try67
Community Expert
Community Expert
July 2, 2017

If you want to clear all the fields in the file just use this code:

this.resetForm();

Participating Frequently
July 2, 2017

Thank you. That is the correct answer. please close this topic