how can I make field ReadOnly after submission of form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-04-2022 11:17 AM
suppose there is custom table say(Student) having a Email field and before submission of form email is auto populate.
As soon as form is submitted the email field must set to Read Only. and when user open the same record in default view of form 'email' field must set to read only.
But When I open the same record the email field in default view of form
is not Read Only?
plz check below client script which is of type onsubmit.
can any one help me out of this issue?
function onSubmit() {
var studName = g_form.getValue('u_name');
var separateName = studName.replace(/\s/g,'');
var course = g_form.getValue('u_course');
g_form.setReadOnly('u_student_email',true);
g_form.setValue('u_student_email',separateName+course+'@demo.com');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-04-2022 11:21 AM
Hi,
write OnLoad client script and use below logic:
function onLoad() {
if(!g_form.isNewRecord()){
g_form.setReadOnly('u_student_email',true);
}
}
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-04-2022 11:22 AM
Hey,
You don't need onsubmit for this, you can have a UI policy in place for this.
You can put condition in the UI policy as Email is empty, then in UI policy action of the field you can set the field as read only true.
This will resolve your issue.
Aman Kumar