api before-save question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Enju
    Senior Member
    • Apr 2018
    • 128

    api before-save question

    Hi,
    I would like to use the before-save API to enable the unit to be saved only after accepting the regulations. The regulations are a boolen field.

    I used the following function, but the unit can be saved even if you do not accept the regulations:
    HTML Code:
    if (regulations == 'false') {
        recordService\throwBadRequest("Accept the regulations before saving");
    }
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    you use not use the quote, it should be like below:

    PHP Code:
    if (regulations == false) {
    recordService\throwBadRequest("Accept the regulations before saving");
    }
    Rabii
    Web Dev

    Comment

    • Enju
      Senior Member
      • Apr 2018
      • 128

      #3
      Originally posted by rabii
      you use not use the quote, it should be like below:

      PHP Code:
      if (regulations == false) {
      recordService\throwBadRequest("Accept the regulations before saving");
      }
      Thank you rabil

      Comment

      Working...