Search code examples
google-app-maker

How to save textbox value in the database


How to save textbox value in the database How to save textbox value in the database (Textbox value populated based on other textbox input value)


Solution

  • Solutions proposed in comments to the question seem to be reasonable, but I would offer one more if you don't mind. If TotalRate field's value is somehow important/vulnerable then I would never store it in database to avoid possible malicious manipulations from app users. In case there is some good reason/requirement to store calculated value in database I would go with calculation on the server side and handle it in onBeforeCreate and onBeforeSave model events:

    // onBeforeCreate/onBeforeSave event handlers
    record.TotalRate = record.PerHourRate * record.HoursNumber;