Clear entered text in a text field in one go using a button

Posted on 2012-08-22
Last Modified: 2012-08-23
Dear Experts:

A fillable form has a textfield where the user can enter free text (multiline text).

A button that is placed next to text field ...
... should enable the user to clear the whole text - he/she has just entered - in one go ... and
... the default text 'Please enter remarks here' has to re-appear.

Is this possible using Java Scripting.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
Question by:AndreasHermle
    LVL 32

    Accepted Solution


    In the simplest form this does not have to carry out an action 'reset' but simply change whatever text is in the field to a text of your choosing.

    For this you use java script action on a button.

    let's assume you have specified the Field 'Text1' and you have the button next to it, you use the following script to change the value when the button is pressed:

      getField("Text1").value = 'Please enter remarks here';

    Open in new window


    Author Closing Comment

    Hi capt.

    Thank you very much for your professional help. It works fine.

    Regards, Andreas
    LVL 32

    Expert Comment

    Great. Glad it helped. :)

    Thanks for the accept.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Can Be Caused By Disabled Services I have encountered a problem viewing PDF files using Adobe Acrobat Reader.  For the longest time, PDFs might launch or might not.  Sometimes they took about 15 minutes to appear after launching them. After som…
    *Adobe Acrobat 9 was used for this article. Particular steps may vary depending on software versions. 1. Create a framework of your form in Word, leaving space where you’d ultimately like the Adobe fields to appear.  (Note: I use the blank lines …
    In this second video of the Xpdf series, we discuss and demonstrate the PDFimages utility, which, in a single command, is able to extract all the images from a PDF file and save each one in a separate image file (PBM, PPM, or JPG). Download and inst…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now