Get Field Value in Grid Add

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
silvana
User
Posts: 22

Get Field Value in Grid Add

Post by silvana »

Hello, I use v2019
In Edit Tag --> Client side events (my page is Grid Add), I need to calculate Wage Amount, So 3 Parameters needed to do calculation. The Code is :

					var sickCategory = $(this).fields("Sick_Category").toNumber();
					var sickName = $(this).fields("Sick_Name").toNumber();
					var dentistId = $(this).fields("Dentist_ID").toNumber();
					if(sickCategory && sickName && dentistId) {

// $("#x1_Dentist_ID").change(function() { // first line is OK !
$("input[data-field='x_Dentist_ID']").change(function() { // Not Working
var data = { "action": "lookup", "linkTable": "tbl_employee_list", "linkField": "Employee_ID", "displayFields": ["Level"], "lookupValue": encodeURIComponent($(this).val()) };
var row = ew.ajax(data);
if (row && row["Level"]){
var dentisLevel = row["Level"];
}
if(dentisLevel == 1){
var data = { "action": "lookup", "linkTable": "tbl_sick_tariffs", "linkField": "Tariffs_ID", "displayFields": ["General_Price"], "lookupValue": encodeURIComponent($("#x1_Sick_Name").val()) }; //Not working on Other Lines
var row = ew.ajax(data);
if (row && row["General_Price"]){
var wageAmount = row["General_Price"];
}
$(this).fields("Wage").value(wageAmount);
}
if(dentisLevel == 2){
var data = { "action": "lookup", "linkTable": "tbl_sick_tariffs", "linkField": "Tariffs_ID", "displayFields": ["Specialist_Price"], "lookupValue": encodeURIComponent($("#x1_Sick_Name").val()) }; //Not working on Other Lines
var row = ew.ajax(data);
if (row && row["Specialist_Price"]){
var wageAmount = row["Specialist_Price"];
}
$(this).fields("Wage").value(wageAmount);
}
});
}
else{
$(this).fields("Wage").value(0);
}
Problem is that the < $("#x1_Dentist_ID").change(function() { > and < encodeURIComponent($("#x1_Sick_Name").val()) }; > Works on first line but when i click on add new line, this not work.
I try to use < $("input[data-field='x_Dentist_ID']").change(function() { > but nothing happend.
Let Me know How can i use change function and encodeURIComponent for each line.
Thanks


mobhar
User
Posts: 11745

Post by mobhar »

silvana wrote:
I try to use < $("input[data-field='x_Dentist_ID']").change(function() { > but nothing
happend.

If "Dentist_ID" field uses Select/Combobox control, then use "select" instead of "input".


Post Reply