Page 1 of 1

Change properties

Posted: Fri Dec 30, 2016 11:23 am
by Arunas
Hi,

I need, IF Field1 value enter 'Yes', THEN Field2 property 'Read only' becoming 'No'. How?

Thanks

Re: Change properties

Posted: Fri Jan 13, 2017 8:22 pm
by mobilemcclintic
I'd use Custom Code and events to do that task for you.

For example, in Custom Code\Javascript, you could use:

function nuLoadEdit() {
if('#Field1#' == 'Yes') {
$('#Field2').prop('readonly',false);
}
}

in order to set the field property to editable when the record loads if Field1 is Yes,
then create a function that enables/disables Field2 if you change Field1 to Yes kind of like:

function field2_en () {
if ($('#Field1').val() == 'Yes') {
$('#Field2').prop('readonly',false);
}
else {
$('#Field2').prop('readonly',true);
}
}

Then on Field1's properties, in the Events tab, create an onchange event and call field2_en();

When you select Yes on Field1, Field2 should turn editable. If you open a record that has Yes in Field1, it should also be editable.
The harder part for me is deciding the exact circumstances for when you want to enable or disable something, and if you want to change or empty fields if (in your case) Field1 was changed to blank or No.

Re: Change properties

Posted: Mon Jan 16, 2017 10:16 am
by Arunas
Thank you. Works!

Re: Change properties

Posted: Tue Jan 24, 2017 2:49 am
by admin
.