Page 1 of 1

Change properties

PostPosted: Fri Dec 30, 2016 7:53 pm
by Arunas
Hi,

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

Thanks

Re: Change properties

PostPosted: Sat Jan 14, 2017 4:52 am
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

PostPosted: Mon Jan 16, 2017 6:46 pm
by Arunas
Thank you. Works!

Re: Change properties

PostPosted: Tue Jan 24, 2017 11:19 am
by admin
.