# Button to modify text area content at insertion point

**URL:** <https://forum.inductiveautomation.com/t/button-to-modify-text-area-content-at-insertion-point/53897>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 8, 2021, 6:45pm UTC](https://forum.inductiveautomation.com/t/button-to-modify-text-area-content-at-insertion-point/53897 "2021-12-08T18:45:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbarker](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cbarker](https://forum.inductiveautomation.com/u/cbarker)\
**Post date:** [December 8, 2021, 6:45pm UTC](https://forum.inductiveautomation.com/t/button-to-modify-text-area-content-at-insertion-point/53897/1 "2021-12-08T18:45:57Z")

</div>

Hello all  
I am working on a markdown editor and have run into a problem regarding text insertion based on buttons. What I am trying to do is make a button that will insert a preformatted string containing the url to an uploaded file.

The uploading of the file and populating the dropdown works already, but the issue arises with insertion.

As far as I can tell, there is no way to know where the insertion point is inside a text area (flashing line when typing, also called cursor, but not to be confused with mouse cursor). Due to this, text could only be appended or prepended to the entire area.

I am trying to create something extremely similar to the link button in this very comment writer.

Is there a way to insert text at the cursor based on a button press?

I have tried the Java Robot, and copy to clipboard to have the user paste in, but due to Ignition running on a debian server, it is headless and both operations fail, blaming the headless for it.

Please let me know  
Thank you

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 9, 2021, 8:03am UTC](https://forum.inductiveautomation.com/t/button-to-modify-text-area-content-at-insertion-point/53897/2 "2021-12-09T08:03:00Z")

</div>

Dont think its possible with java as in perspective you are using javascript, so you will need javascript for that, for which you would need a custom module.

Copy clipboard usually doesnt work in the browser tho as it is protected, maybe try a different insert methoded with robot. but i doubt it will work

---

<div class="post-metadata">

**Author:** ![cbarker](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cbarker](https://forum.inductiveautomation.com/u/cbarker)\
**Post date:** [December 9, 2021, 1:18pm UTC](https://forum.inductiveautomation.com/t/button-to-modify-text-area-content-at-insertion-point/53897/3 "2021-12-09T13:18:47Z")

</div>

The robot from Java also does not work in perspective. The robot = Robot() line fails not due to imports but because of this issue  
Thank you for this info though.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 9, 2021, 1:58pm UTC](https://forum.inductiveautomation.com/t/button-to-modify-text-area-content-at-insertion-point/53897/4 "2021-12-09T13:58:53Z")

</div>

yeah i thought so…  
You will need js acces for this  
or ask for a feature to add in a copy to clipboard function than the user would just have to paste it where they want. and a general copy to clipboard might be accepted as feature
