[SOLVED] Field update in Master Page using UpdateMaster does not save to database |
10/30/2025 13:34:31 | |
| PHPRunner General questions | ||
|
C
chandoshi authorDevClub member
I have the following code that updates a field in master record when child table is edited. var mPage = pageObj.getMasterPage(); The code works as it should, but when I save the master record this values does not get saved to database. |
||
|
|
ChatGPT 10/30/2025 |
|
Yes, to ensure that the updated value is saved to the database when the master record is updated, you will need to perform a few additional steps. The code you provided updates the displayed value on the page, but it does not actually update the data in the database. Here’s how you can do this:
By doing this, you ensure that the updated value in the user interface is also reflected in the database when the master record is saved. |
|
|
C
|
chandoshi authorDevClub member 10/30/2025 |
|
The solution provided by AI as shown below does not work: changed the code to save the value: Updating PaidAmt before Record Update as follows: |
|
|
|
fhumanes 10/30/2025 |
|
Hello, I don't know if this example will help you. I think it's similar to what you're trying to do. Greetings, |
|
|
C
|
chandoshi authorDevClub member 10/30/2025 |
|
Hi Frenando, I could not find any code I could use from the solution link you provided. Can you point out to the code if ther is one that I could use. As far as the solution from Chat GPT, ir seems to be using Rest API. This application does not have REST API activated. |
|
|
|
fhumanes 11/1/2025 |
|
Hello, The example shows how an invoice would work. In both ADD and EDIT, it is shown that if you modify the invoice lines (detail), the Invoice header (master) is updated. This is done through Javascript and that is what the example shows. It mainly relies on updating the fields in JavaScript and then "recalculating" the result in PHP. For it to work well, the Master field that you want to update must be in the Add or Edit and then modified so that the user cannot edit it. Greetings, |
|
|
C
|
chandoshi authorDevClub member 11/3/2025 |
|
Thanks for the explaination. The solution is to save the updated value in session variable and use it before saving the record. That should work. |
|