Velo and cms coding

Question:
To prevent users from editing their submissions after they’ve been submitted, unless an admin intervenes:

Add a Boolean Field: Include a field in your collection that tracks whether a submission has been locked.

Conditional Editing: In your form logic, check this field to determine if the form should allow editing. Only enable form fields if the submission has not been locked.

javascriptCopy code
import wixData from ‘wix-data’; // Example function to check if the form should be locked export function checkIfLocked(userId) { return wixData.query(‘myCollection’) .eq(‘userId’, userId) .find() .then(results => { if (results.items.length > 0) { return results.items[0].isLocked; // Assuming ‘isLocked’ is the field name } return false; }); }

can you help me with the code

Product:
velo

What are you trying to achieve:
Can I have button or text where if a user clicks on it, certain details should be fixed , the user should not be able to edit once submitted(if user wants to edit, then the user should contact admin as the admin have access).

What have you already tried:
resources, forum topics, articles, or tutorials

This can actually be done just with Content Collection permissions. You can let users insert a row but not update it after: CMS: Collection Permissions Overview | Help Center | Wix.com