Page 1 of 1

Make lookup field readonly after insert

Posted: 2021-08-26 04:49
by ltlow
I have a table name quotation and have a lookup field name code. I want to make this lookup field(code) readonly after insert the record, so I try to add this code to my quotation-dv.js but it didn't work.

if($j('[name=SelectedID]').val().length) {
$j(function(){
$j('#code-container').select2('readonly', true);
})
}

Strange thing is when I try this code in my chrome console, it does work. But there is another problem, user still can use the + button to add new record to code lookup field and it auto change the value to the newly add record. Is any way to hide/make this button readonly also?