dependent dropdown in a subform

Questions related to customising nuBuilder Forte with JavaScript or PHP.

Re: dependent dropdown in a subform

Unread postby johan » Mon Nov 22, 2021 10:59 pm

Kev1n

I still got the same result in my subform. Only Turnhout in the first row gevangenis and the rest is blanc.

Johan
johan
 
Posts: 360
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: dependent dropdown in a subform

Unread postby kev1n » Mon Nov 22, 2021 11:02 pm

Can you export your db again?
kev1n
nuBuilder Team
 
Posts: 2135
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: dependent dropdown in a subform

Unread postby johan » Tue Nov 23, 2021 12:04 am

Kev1n
Thanks for your help.
Johan
Attachments
reg_gevangenis.sql.zip
(216.53 KiB) Downloaded 5 times
johan
 
Posts: 360
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: dependent dropdown in a subform

Unread postby kev1n » Tue Nov 23, 2021 12:21 am

I forgot to mention that the SQL is messed up:
Code: Select all
SELECT distinct secties.sec_id, secties.sec_name FROM secties where secties.sec_gevangenis = WHERE secties.sec_gevangenis = '#VALUE_SELECT1#'
   OR '#VALUE_SELECT1#' LIKE '#%';


This is correct:

Code: Select all
SELECT distinct secties.sec_id, secties.sec_name FROM secties
WHERE secties.sec_gevangenis = '#VALUE_SELECT1#'
   OR '#VALUE_SELECT1#' LIKE '#%'
kev1n
nuBuilder Team
 
Posts: 2135
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: dependent dropdown in a subform

Unread postby johan » Sat Nov 27, 2021 8:32 pm

Kev1n
Thanks a lot for your help. Now the items on subform are populated correct.
Since this change I occur a problem with depending select using
Code: Select all
("#act_lokaal").empty();
nuRefreshSelectObject('act_lokaal');
$("#act_sectie").empty();
nuRefreshSelectObject('act_sectie')

Could it be that there is a conflict with subform items?
johan
 
Posts: 360
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: dependent dropdown in a subform

Unread postby kev1n » Sat Nov 27, 2021 8:55 pm

Replace the function nuRefreshSelectObject() in nucommon.js with this one and log in again:

Code: Select all
function nuRefreshSelectObject(selectId, formId, removeBlank) {

   if (typeof formId === 'undefined') {
      var formId = '';
   }

   nuSetProperty('nurefreshselectobject_selectid',selectId);
   nuSetProperty('nurefreshselectobject_formid',formId);
   nuSetProperty('nurefreshselectobject_prefix','');
   nuSetProperty('nurefreshselectobject_removeblank',removeBlank === true ? '1' : '0');

   nuRunPHPHidden('nurefreshselectobject', 0);

}
kev1n
nuBuilder Team
 
Posts: 2135
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Previous

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 7 guests