Page 1 of 1

How to condition fields in a subform

Posted: Tue Feb 18, 2025 3:26 pm
by cuadradoja
Hi,

I have a subform called sub_forta. In it I have several fields and among them, one type input (nuNumber) called sf_pes and the other type checkbox called sf_select.

I would like to know how the sf_select field can be disabled when it detects that the sf_pes field (corresponding to the same row) changes to a value other than null.

Thanks for your help...

Re: How to condition fields in a subform

Posted: Tue Feb 18, 2025 7:30 pm
by kev1n
Hi,

Add an onchange event for sf_pes and run the code below (untested):

Code: Select all

const id = event.target.id;

const $sf_pes = nuSubformRowObject(id, 'sf_pes')
const $sf_select = nuSubformRowObject(id, 'sf_select');

nuEnable($sf_select.attr('id'), $sf_pes.nuGetValue() === '');

Re: How to condition fields in a subform

Posted: Sun Feb 23, 2025 12:51 am
by cuadradoja
Hi again,

It worked perfectly... :thumb:

Thanks a lot!!