readOnly is a lovely way of protecting your customer data in a database where some data is preloaded.
The fastest way of implementing this is to use BEs onFocus box when editing a question and add in
<syntaxhighlight lang="javascript">
this.blur();
</syntaxhighlight>
That will stop any editing of the box but can break up the flow of tabbing through the document.
Another alternative and the one we recommend is to put in the onFocus box
<syntaxhighlight lang="javascript">
this.defaultIndex=this.selectedIndex;
</syntaxhighlight>
and in the onChange to put
<syntaxhighlight lang="javascript">
this.selectedIndex=this.defaultIndex;
</syntaxhighlight>
An alternate, but which doesn't work on drop down lists is
<syntaxhighlight lang="javascript">
document.getElementById("fieldnameHere").readOnly=true;
</syntaxhighlight>
When you have data loaded into a database, the customers data will generally be presented to an agent / user. You may not want them editing particular details like a customer Id or reference details.