Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

How to condition fields in a subform

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
cuadradoja
Posts: 27
Joined: Thu Sep 01, 2022 3:42 am
Has thanked: 1 time

How to condition fields in a subform

Unread post 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...
kev1n
nuBuilder Team
Posts: 4291
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: How to condition fields in a subform

Unread post 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() === '');
cuadradoja
Posts: 27
Joined: Thu Sep 01, 2022 3:42 am
Has thanked: 1 time

Re: How to condition fields in a subform

Unread post by cuadradoja »

Hi again,

It worked perfectly... :thumb:

Thanks a lot!!
Post Reply