Get field values ​​from browseForm

Questions related to customising nuBuilder Forte with Javascript or PHP.

Get field values ​​from browseForm

Unread postby kknm » Tue Apr 06, 2021 6:26 pm

The main form has several view forms filtered by value from the select object.
Now I need to get the first values ​​from browseForms on click from and write them to several inputboxes, each inputbox should get values ​​from different forms.
jurnal.png
jurnal.png (106.3 KiB) Viewed 46 times
kknm
 
Posts: 204
Joined: Sat Apr 11, 2020 7:33 am

Re: Get field values ​​from browseForm

Unread postby kev1n » Tue Apr 06, 2021 6:46 pm

Example to access a cell value in an iframe:

Code: Select all
var f = $("#your_frame_id")[0].contentWindow;
var cellVaue = f.$('#nucell_1_1').html();


With the latest version, it's even easier:

Code: Select all
var cellVaue = nuGetIframeValue('your_frame_id','nucell_1_1','html);
kev1n
nuBuilder Team
 
Posts: 1625
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Get field values ​​from browseForm

Unread postby kknm » Tue Apr 06, 2021 7:53 pm

kev1n wrote:Example to access a cell value in an iframe:

Code: Select all
var f = $("#your_frame_id")[0].contentWindow;
var cellVaue = f.$('#nucell_1_1').html();


With the latest version, it's even easier:

Code: Select all
var cellVaue = nuGetIframeValue('your_frame_id','nucell_1_1','html);

How do I get the value using nuSelectBrowse?
kknm
 
Posts: 204
Joined: Sat Apr 11, 2020 7:33 am

Re: Get field values ​​from browseForm

Unread postby kev1n » Tue Apr 06, 2021 7:59 pm

Code: Select all
function nuSelectBrowse(e) {

  let cellValue = e.target.innerText;
  nuMessage([cellValue]);

}

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

Re: Get field values ​​from browseForm

Unread postby kknm » Tue Apr 06, 2021 9:05 pm

kev1n wrote:
Code: Select all
function nuSelectBrowse(e) {

  let cellValue = e.target.innerText;
  nuMessage([cellValue]);

}


Now how do you insert this value into the inputbox of the main form?
kknm
 
Posts: 204
Joined: Sat Apr 11, 2020 7:33 am

Re: Get field values ​​from browseForm

Unread postby kev1n » Tue Apr 06, 2021 9:32 pm

Code: Select all
function nuSelectBrowse(e) {

  let cellValue = e.target.innerText;
  parent.$('#input_id_main_form').val(cellValue).change();

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

Re: Get field values ​​from browseForm

Unread postby kknm » Tue Apr 06, 2021 9:44 pm

Now everything works ... but the form (:: RUN) from which the value (cellvalue) is obtained is zeroed, i.e. Loses the filter by which it was filled.
kknm
 
Posts: 204
Joined: Sat Apr 11, 2020 7:33 am

Re: Get field values ​​from browseForm

Unread postby kev1n » Tue Apr 06, 2021 10:28 pm

try omiting .change(); if the value in the input doesn't have to be saved in the database.

or use this line instead:
Code: Select all
parent.$('#input_id_main_form').val(cellValue).addClass('nuEdited');
kev1n
nuBuilder Team
 
Posts: 1625
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Get field values ​​from browseForm

Unread postby kknm » Tue Apr 06, 2021 10:49 pm

Omitted onchange - now everything is correct. Thanks!
kknm
 
Posts: 204
Joined: Sat Apr 11, 2020 7:33 am

Re: Get field values ​​from browseForm

Unread postby kknm » Wed Apr 07, 2021 3:37 pm

Another question arose...
How to get multiple values ​​from one row on click (nuSelectBrowse)?
kknm
 
Posts: 204
Joined: Sat Apr 11, 2020 7:33 am

Next

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 5 guests

cron