Page 1 of 2
Get field values from browseForm
Posted: Tue Apr 06, 2021 10:56 am
by kknm
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
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 11:16 am
by kev1n
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);
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 12:23 pm
by kknm
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?
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 12:29 pm
by kev1n
Code: Select all
function nuSelectBrowse(e) {
let cellValue = e.target.innerText;
nuMessage([cellValue]);
}
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 1:35 pm
by kknm
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?
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 2:02 pm
by kev1n
Code: Select all
function nuSelectBrowse(e) {
let cellValue = e.target.innerText;
parent.$('#input_id_main_form').val(cellValue).change();
}
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 2:14 pm
by kknm
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.
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 2:58 pm
by kev1n
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');
Re: Get field values from browseForm
Posted: Tue Apr 06, 2021 3:19 pm
by kknm
Omitted onchange - now everything is correct. Thanks!
Re: Get field values from browseForm
Posted: Wed Apr 07, 2021 8:07 am
by kknm
Another question arose...
How to get multiple values from one row on click (nuSelectBrowse)?