Form Lock input

[Total: 0    Average: 0/5]

This shows how to keep a user from updating a form field upon a radio button selection that the user can select to lock that field.

Body Code:

<form name="_f"> 
<input type=radio name=_l checked onclick='setLock(0)' value='0'>Open
<input type=radio name=_l         onclick='setLock(1)' value='1'>Locked
<input type=text  name=_t value='' onfocus='blurIfLocked()'>
</form>
<script type=text/javascript>
var locked=0; // 0 open : 1 locked.
function setLock(_l) {locked=_l;}
function blurIfLocked() {
 if (locked==1) document._f._t.blur()
}
function setTo(_v) {
  if (locked!=1) document._f._t.value=_v;
}
</script>
<BR><a href="javascript:setTo('one')">ONE</a>
<BR><a href="javascript:setTo('two')">TWO</a>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *