Table of Contents

How to write to the clipboard from an HTML property using JavaScript events


A developer asks: We are trying to write data to the clipboard from an HTML Property rule (rather than from a Submit button).   We have a Date-Calendar property that upon selection of a date needs to:

  • Calculate and set another date on the same form, and
  • Be inserted into a Dynamic Select control on the same form.

For this to happen we need to add the data from the Date-Calendar property to the clipboard.

We've tried various techniques for calling an activity from the calendar HTML code (doFormSubmit / URL type calls), but either they do not work or they prompt with an 'all data will be lost' message (as if a separate object is being created).

What the best approach is for writing data to the clipboard (without submitting the form): JavaScript, JSP, or embedded Java?


Suggested Approach

You can accomplish this by creating reSubmit versions of your HTML Property rules - where the Onchange event for a HTML Property rule calls the reSubmit() function, which is part of the harness JavaScript API.  

At runtime, that reSubmits the flow action to the server without changing state in the flow, but any updated values input on the form are submitted. 

This approach can provide, for example, a way to do server-side population of calculated fields using declarative rules.   So if you put such a reSubmit() call on the Onchange event of your date textbox, whenever that field changes:

  • the change hits the server
  • any Declare Expression rule defined for that property executes
  • the user is re-presented with an updated display of the same flow action.   

Process Commander uses a similar reSubmit() approach in the Work-.SendCorrespondence flow action.

Suggest Edit

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.