Getting field value before update record

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

Getting field value before update record

Post by christ2000 »

Hello, i am using the following code to try to get both values, first the old field value and the same new field value before update my dropdown field:

// Assume this is your initial capture, perhaps on page load or some initialization
var currentVisibleText2014 = $("#x_Providersh2014 option:selected").text();

// Event handler for when the dropdown changes, for example, on change event
$("#x_Providersh2014").on("change", function () {
  // Update the variable when the dropdown changes
  currentVisibleText2014 = $(this).find(":selected").text();
  console.log("Updated Visible Text 2014:", currentVisibleText2014);
});

my problem is i don't get the new value input on the dropdown field(before save the record), just the old one, can some one check this?

thanks


mobhar
User
Posts: 11851

Post by mobhar »

Why don't you use Row_Updating server event by optimizing the $rsold and $rsnew objects?


christ2000
User
Posts: 528

Post by christ2000 »

hello the problem i am still trying to setup tinymce templates, so i need work with client scripts, my tiny code look as:


                title: 'Change of Staff',
                description: 'This is email for Change of Staff.',
                content: `<p class="MsoNormal"><span style="font-family: 'Calibri Light', sans-serif;">Hello Staff,</span></p>
<p class="MsoNormal"><span style="font-family: 'Calibri Light', sans-serif;">Please find below the change of staff:</span><span style="font-family: 'Calibri Light', sans-serif;">&nbsp;</span></p>
<p class="MsoNormal"><span lang="es-us" style="font-family: 'Calibri Light', sans-serif;" xml:lang="es-us">Client:</span><strong><span lang="es-us" style="font-family: 'Calibri Light', sans-serif;" xml:lang="es-us"> ${$("#x_Name").val()} ${$("#x_LastName").val()}<br></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Calibri Light', sans-serif;">Previous RBT:&nbsp;<strong>${oldDropdownValue2014}</strong></span></p>
<p class="MsoNormal"><span style="font-family: 'Calibri Light', sans-serif;">New RBT: <strong>${updatedDropdownText2014}</strong></span></p>
<p class="MsoNormal"><span style="font-family: 'Calibri Light', sans-serif;">Effective: <span style="background-color: rgb(241, 196, 15);"><strong>05/17/2023</strong></span></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>`
            }
        ];

christ2000
User
Posts: 528

Post by christ2000 »

the old value work perfect, the problem is on my tinymce template i need to show the old and new values on this record, so the i dont have sucess getting the old value on the dropdown field before save and put on the template. my template must look as:

Hello Staff,

Please find below the change of staff: 

Client: Maria Perez


Previous RBT: Peter Tom

New RBT: Robert Wilson 

Effective: 05/17/2023

arbei
User
Posts: 9618

Post by arbei »

If the field is a lookup field, you may see Retrieving selections.


christ2000
User
Posts: 528

Post by christ2000 »

Yes it is a lookup field, let me check that, thanks


Post Reply