protect text input fields from being editeded

Mar 23, 2020


Is there a way to protect a text input field from being edited - almost like a read only view?

I have a project where I want different users to access the same project at different where a user can edit text input fields and the other where a user can view what a person has typed but not edit...

One option is to cover the input text fields to stop a user interacting..but the poblem is one of the text fields automatically always takes the focus. I can remove tabbing but one of the input text fields always remains editable. I have been able to have another field off slide take the focus and with no tabbing it's a workaround. However, this means there can be no tabbing allowed.

Can anyone think of any other solution?



9 Replies
Lauren Connelly

Hi Chris!

Another thought would be to add variables to change the state of the text entry fields to disabled when they're not equal to (blank).

We might be able to give you customized workarounds if we can take a look at your file. Would you mind either attaching it to this discussion or upload it privately using this link?

Chris Pim

Two different people will be accessing the same 'account'

The content is being read in from a database via variables in Storyline...some of that content is related to input textfields - the content will either be blank by default or contain text edited by one user...What I want is a way for a second user to review that typed content but not be able to edit the second user is effectively going into the first user's account.


Chris Pim

Hi Matt,

Thanks for your help with this...

The course would receive a boolean to say whether it is the user who can or cannot text edit...

I'd appreciate any help you could give on using javascript to do this...would javascript run on every slide, every input box or something more global...if you have the inclination I would appreciate some possible help. You have helped me a  number of times before btw!



Chris Pim

Hi Matthew,

Thanks for helping me with this.

Not sure if I am doing this right but I tried adding a trigger both on the slide and on the master (this is the version I am sending) just....  'Execute Javascript when the timeline starts'...I copied exactly your javascript into the Javascript pane.

I notice when compiled that the first text box receives the focus and I can type into it and tab to the others and also type in them.

I also have layers with textboxes in them and I'm not sure, if the Javascript does work, if it would apply to textboxes in layers?

Anyway I cant get this working initially? Any thoughts?

Chris Pim

Hi Matt

This works beautifully. It even works when the javascript runs on slide startup. Perfect. Yet it isn't working for my projects. I spent several hours trying to understand why...I thought it was to do with the input text field being within a scrollbar. Finally I worked out it seems to be because the javascript code does not work when the text field accepts more than one line of text...? See attached...

The problem is I need the editior and viewer to be able to browse whatever amount of text there is in the I have to extend the input textbox to allow multiple lines of text that can then be browsed using the scrollbar...I find an input text box containing a varaible that could read in any amout of text a real mess but it just about works for my project...

In short is there a way to get the code working for input fields beyond one line of text?

Chris Pim

Hi Matt,

FYI. Someone else has also helped me and this code appears to work:

var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
inputs[i].setAttribute("disabled", "true");


var textareas = document.getElementsByTagName('textarea');
for (var i = 0; i < textareas.length; i++) {
textareas[i].setAttribute("disabled", "true");


This discussion is closed. You can start a new discussion or contact Articulate Support.