What you want isn't something that I'd control with scripting, but with settings inside Manage | Security.
You can set up a Custom Privileges for Records with a "limited" access expression for the user's ability to edit/create and/or delete a record with something like this:
IsEmpty ( CheckBoxField )
As long as the field is empty a user with that privilege set can edit the record. Once it is set, they can no longer edit it. If you need to allow the user to reopen the record for editing under certain circumstances, you can use a script like the following and set it to run with full access privileges: (select script by name and choose "grant full access privileges" from the file menu inside the scripts workspace.)
Set Field [YourTable::CheckBoxField ; "" ]
OK, I did this part; set up a Custom Privileges for Records with a "limited" access expression for the user's ability to edit/create and/or delete a record with; IsEmpty ( CheckBoxField )
In my database this CheckBox is called Field 5 so I put; IsEmpty (Field 5).
Now when user checks this field he is locking only edit of that field and I want to lock all fields in the layout.
No, that is not possible. That process locks the entire record.
I also recomend renaming your field to something more descriptive.
I'd check to make sure that all the fields on your layout are from the same table and from the same record in that table.
Yep, that was the problem...I have some fields from another table and that is why it didn't lock them. Thank you