# In need of some help - Modal text input with cancel

**URL:** <https://discourse.nodered.org/t/in-need-of-some-help-modal-text-input-with-cancel/15125>\
**Category:** Dashboard\
**Created:** [4 September 2019 22:42 UTC](https://discourse.nodered.org/t/in-need-of-some-help-modal-text-input-with-cancel/15125 "2019-09-04T22:42:01Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2019 11:57 UTC](https://discourse.nodered.org/t/in-need-of-some-help-modal-text-input-with-cancel/15125/12 "2019-09-09T11:57:05Z")

</div>

> [@RaptorUK](#):
>
> I made some mods and got the dialog to open automatically when the template was triggered by an inject node . . . it's still not what I would ideally like, it doesn't retain focus so there is still scope for the user to get things wrong, the whole point of trying to use a dialog was for it to be modal and retain focus, this would mean that the user couldn't leave this text input without either scanning the QR code or clicking Cancel.

You could simply add a bit script so that when the input box loses focus, you simply set focus once more.

```auto
<script type="text/javascript">
    var element= document.getElementById('return_value');
    element.focus();
    element.onblur= function() {
        setTimeout(function() {
            element.focus();
        }, 0);
    };
</script>

```

---

_[View the full topic](https://discourse.nodered.org/t/in-need-of-some-help-modal-text-input-with-cancel/15125)._
