Clearing Rich Text Fields in Document with Action Button

Hi, I want to create an action button that will clear all fields in my document including Rich Text. I am struggling with clearing the rich text and am using this code…

@Command([EditGotoField];“field name”); @Command( [EditSelectAll]); @Command([Clear]);

…which works but if a rich text field happens to be empty, it displays a message “Cannot Locate Field”. This happens for every rich text field that is empty… rather confusing for users.

Does anyone know of a better way to do this?

Thanks, Paul

Subject: EditInsertText

Using formula language is a but tricky but sometimes you can out trick it. Try adding a single character to the field before clearing it by using @Command([EditInsertText]; “x”) just before EditSelectAll should work.

When I tested this I got a different error than you did. Mine was “cannot execute the specified command”. Also, it only throws an error if the last field the code acts on is empty.

Subject: Thanks

Hi Paul,

Thanks for taking time to look into this. I recently discovered the error occured when the field was in a collapsed section. When a ran “@Command([SectionExpandAll])” first everything worked fine. Apparently the error was generated when the command couldn’t find the variable.

Take care, Paul

Subject: OK

that would be why we got different error msgs and you are correct about the collapsed section being the cause. peace