This topic is locked

Readonly

8/1/2008 4:08:08 AM
PHPRunner General questions
G
garethp authorDevClub member

Hi
I have a table `supplier` with a field called `lock` which is a checkbox.
When the user clicks edit from the list page if the value of lock = 1 I require the field to be readonly and if the value = 0 I required it to be editable.
I don't want to do this with javascript as the user may change the value to 1 on the edit screen and then change their mind and want to change it back to zero - if I make it readonly with Javascript this wont work.
Can I use an before edit event to achieve this?
Many thanks
Gareth

J
Jane 8/1/2008

Gareth,
just use your JavaScript as onload function.

For example add following code to the page:

<script>

if (document.forms.editform.value_FieldName.checked)

document.forms.editform.value_FieldName.disabled = true;

</script>

G
garethp authorDevClub member 8/4/2008

YET AGAIN ANOTHER FANTASTIC ANSWER!!! tHANKS SO MUCH