# How do I load a .txt file into a textbox and make the textbox readonly?

**URL:** <https://discourse.processing.org/t/how-do-i-load-a-txt-file-into-a-textbox-and-make-the-textbox-readonly/20407>\
**Category:** Coding Questions\
**Created:** [May 2, 2020, 9:14pm UTC](https://discourse.processing.org/t/how-do-i-load-a-txt-file-into-a-textbox-and-make-the-textbox-readonly/20407 "2020-05-02T21:14:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [May 2, 2020, 9:14pm UTC](https://discourse.processing.org/t/how-do-i-load-a-txt-file-into-a-textbox-and-make-the-textbox-readonly/20407/1 "2020-05-02T21:14:21Z")

</div>

I’m trying to create essentially a EULA page.

I want to load a preexisting text file into it a textbox and I want to make the textbox read only.

Is this possible in p5.js?

Thanks in advance.

[https://editor.p5js.org/Bassam/sketches/5ZXuP1Q7E](https://editor.p5js.org/Bassam/sketches/5ZXuP1Q7E)

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 2, 2020, 11:39pm UTC](https://discourse.processing.org/t/how-do-i-load-a-txt-file-into-a-textbox-and-make-the-textbox-readonly/20407/2 "2020-05-02T23:39:49Z")

</div>

One way to do this is with a separate small JavaScript, not in the p5.js sketch.

if you want it controlled from within the sketch, you could also use p5.dom.

[https://p5js.org/reference/#/libraries/p5.dom](https://p5js.org/reference/#/libraries/p5.dom)  
[https://p5js.org/examples/dom-modifying-the-dom.html](https://p5js.org/examples/dom-modifying-the-dom.html)

Use a dom call to make a standard html+css form in a div visible on the page. The sketch makes the div visible. Then, on the form submit action, the div becomes hidden again.

- [https://www.w3schools.com/howto/howto\_js\_popup\_form.asp](https://www.w3schools.com/howto/howto_js_popup_form.asp)
- [https://blog.formpl.us/how-to-create-a-simple-cookie-consent-pop-up-for-your-website-dad17a174b60](https://blog.formpl.us/how-to-create-a-simple-cookie-consent-pop-up-for-your-website-dad17a174b60)
  - … demo of: [https://codepen.io/DeolaJ/pen/vPOGwv](https://codepen.io/DeolaJ/pen/vPOGwv)

---

<div class="post-metadata">

**Author:** ![montoyamoraga](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/montoyamoraga/32/16457_2.png) [@montoyamoraga](https://discourse.processing.org/u/montoyamoraga)\
**Post date:** [May 2, 2020, 11:39pm UTC](https://discourse.processing.org/t/how-do-i-load-a-txt-file-into-a-textbox-and-make-the-textbox-readonly/20407/3 "2020-05-02T23:39:59Z")

</div>

hi!  
what about loading the file on preload(), and then using the function createP() ?  
[https://p5js.org/reference/#/p5/createP](https://p5js.org/reference/#/p5/createP)

---

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [May 4, 2020, 2:09pm UTC](https://discourse.processing.org/t/how-do-i-load-a-txt-file-into-a-textbox-and-make-the-textbox-readonly/20407/4 "2020-05-04T14:09:33Z")

</div>

This is all more complicated than I would like.  
I think I’ll just use images of the text instead.  
Thanks though.
