Re: Reference fields dynamically based on previous entry. Reply #15 – July 27, 2020, 09:20:40 PM Quote from: willvin – July 19, 2020, 03:51:02 PM@Catalin as promised, here is the solution to his issue.This👇 was added to his student Select field ClientEvents.Code: [Select]$('#ctrl-Student_Name').on('change', function(){ let student_name = $(this).val(); sendData(student_name);});Do not worked for me... ...after many retries, I'm trying now to activate error log... to see what is happening..[/code] Quote Selected Last Edit: July 27, 2020, 09:22:38 PM by Catalin
Re: Reference fields dynamically based on previous entry. Reply #16 – July 28, 2020, 10:22:58 AM @Catalin please make sure to replace the field id with your field id, as the example above contains the field id of the user the fix was made for. Quote Selected
Re: Reference fields dynamically based on previous entry. Reply #17 – July 29, 2020, 06:22:29 PM Quote from: willvin – July 28, 2020, 10:22:58 AM@Catalin please make sure to replace the field id with your field id, as the example above contains the field id of the user the fix was made for.I did it but it's not working; I posted my code in the initial topic; it will help me if I can have errors captured in the log, but nothing in the log. Quote Selected
Re: Reference fields dynamically based on previous entry. Reply #18 – July 30, 2020, 11:08:18 AM Quote from: Catalin – July 29, 2020, 06:22:29 PMQuote from: willvin – July 28, 2020, 10:22:58 AM@Catalin please make sure to replace the field id with your field id, as the example above contains the field id of the user the fix was made for. I did it but it's not working; I posted my code in the initial topic; it will help me if I can have errors captured in the log, but nothing in the log. To see javascript error, you have to view your browser console, phprad does not handle that. my answer o the other forum was for PHP code having errors. Quote Selected
Re: Reference fields dynamically based on previous entry. Reply #19 – August 26, 2020, 09:00:20 AM Sorry to say but is a NASTY BUG related with this feature, as follow:1) In the PAGE-SCRIPTS.JS in case an event is sent to server al the time is written in the JS file as:$('#ctrl-Field_Name').on('change', function(){ ...}but WITHOUT "Table_Name" and this will duplicate the functions in JS file, because SAME FIELD named "ctrl-Field_Name" may appear in several Tables with different functions... 2) In this regard, you receive random-values depending on which function is executed.Is a nasty bug !Correct call into the PAGE-SCRIPTS.JS for the function should be written as:$('#ctrl-Table_name.Field_Name').on('change', function(){ ...}This is a VERY USEFUL functionality, please do a work around ...and let me know This error may make the ClientEvent useless because of impredictibility described, which is bad because is a cool and useful functionality.To better understand I'm giving you bellow a sample code from the Application.;$('#ctrl-Cod_Unic_Linie_Buget').on('change', function(){ let Cod_Unic_Linie_Buget = $(this).val(); sendCimLinieBugetProiect(Cod_Unic_Linie_Buget);});function sendCimLinieBugetProiect(Cod_Unic_Linie_Buget){ var data = {// We are trying to organize our data for the server codliniebuget: Cod_Unic_Linie_Buget } //We now make an ajax post to the server var request = $.ajax({ type: 'POST', // the type of request we are making. url: siteAddr+'api/getLinieBugetProiect/?csrf_token='+csrfToken, //our api link/url data: data, // the data we are sending to the server cache: false, // we dont want the request to be cached. //dataType: 'json' //the type of data we expect our api to return. }); // Now we check for response that will be gotten from the server. // Callback handler that will be called on success request.done(function (response, textStatus, jqXHR){ $('#ctrl-Categorie').val(response.data.Nume_cat_cheltuiala_eligibila); $('#ctrl-Subcategorie').val(response.data.Nume_subcat_cheltuiala_eligibila); }); // Now we check for errors we get when trying to make our post request. // Callback handler that will be called on failure request.fail(function (jqXHR, textStatus, errorThrown){ // Log the error to the console console.error( "The following error occurred: "+ textStatus, errorThrown ); });}$('#ctrl-Cod_Unic_Linie_Buget').on('change', function(){ let Cod_Unic_Linie_Buget = $(this).val(); sendLinieBugetProiect(Cod_Unic_Linie_Buget);});function sendLinieBugetProiect(Cod_Unic_Linie_Buget){ var data = {// We are trying to organize our data for the server codliniebuget: Cod_Unic_Linie_Buget } //We now make an ajax post to the server var request = $.ajax({ type: 'POST', // the type of request we are making. url: siteAddr+'api/getLinieBugetProiect/?csrf_token='+csrfToken, //our api link/url data: data, // the data we are sending to the server cache: false, // we dont want the request to be cached. //dataType: 'json' //the type of data we expect our api to return. }); // Now we check for response that will be gotten from the server. // Callback handler that will be called on success request.done(function (response, textStatus, jqXHR){ $('#ctrl-Categorie').val("Something Else"); $('#ctrl-Subcategorie').val("Random text"); Quote Selected Last Edit: August 26, 2020, 09:03:16 AM by Catalin