Good morning,
for account module, I would like set some fields readonly for all users when a particular field is set (if field has a value).
Someone has my same need and has an example?
How can I implement this mechanism?
Thank you so much.
B.
Good morning,
for account module, I would like set some fields readonly for all users when a particular field is set (if field has a value).
Someone has my same need and has an example?
How can I implement this mechanism?
Thank you so much.
B.
This requires a bit of knowledge about fixing .PHP files. just find them in this path β¦/modules/AOS_Quotes/metadata β¦ edit files: detail_view, list_view, edit_view and add readonly = βreadonlyβ within fields you wish.
Hi, thank you for your reply,
but I would like set some fields readonly (i.g. name, industry, type, etc., but also custom fields) only if a particular field (in my case, custom field, code_c) is set.
if code_c is not set, the fields must be editable, otherwise they must be read-only.
In the path that you mentioned: ./modules/AOS_Quotes/metadata, I canβt find examples that implement this mechanism.
Have you a example code to paste here?
Thank you.
B.
First time include javascript file in your editview,
In your javascript file write this
$('#custom field').change(function(){
console.log("marche");
if ($('#custom field').val() == "")
{
$('#field_to_put_readonly').prop('readonly', true).css('background-color','#dcdcdc');
}
else {
$('#ield_to_put_readonly').prop('readonly', false).css('background-color','#416f81');
}
});
Thank you very much Babacar.
In my case, custom field is a readonly property because is set by background script. I put all code into $(document).ready and it works.
B.
Hello Babacar,
Is it work fine for text field. But what about select field.
If I set disabled to select field it will not submit to server.
I want to make βselectβ field readonly which is depend on another field.
Have a look at the add-in dynamic-panels from the store. This enables exactly what you need.
Hi jrawoot,
I used this instruction to make select readonly:
$('#account_type').prop('disabled', setReadonly).css('background-color',bck_color);
Hope it helps you,
B.
Hello bf.ts90.
it is not working for me
giving following error: Uncaught ReferenceError: setReadonly is not defined
Hi,
sorry, setReadonly for me is a boolean variable.
substitute setReadonly with true and it works.
B
Hello bf.ts90.
Thanks for quick reply.
It works but after submitting form value will be not submit to server.
Thanks