Answers.Body: <p><code>on_change</code> is executed when setting value is changed. You can either set it </p>
  
  <pre><code> 'on_change' =&gt; [
     ['CLASS_NAME', 'functionName'],
   ],
  </code></pre>
  
  <p>Else </p>
  
  <pre><code>'on_change' =&gt; [
    'CLASS_NAME::functionName',
  ],
  </code></pre>
  
  <p>A good example would be <a href="https://github.com/civicrm/civicrm-core/blob/master/settings/Localization.setting.php#L145" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/blob/master/settings/Localization.setting.php#L145</a></p>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-08T13:38:15.757Z
Answers.Text: Is there any way to pass values through this? Or do I need an API call in my function to get the new value for the setting?
Answers.UserDisplayName: Sleewok
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-08T13:48:50.717Z
Answers.Text: functionName($oldValue, $newValue, $metadata, $domainID) {}
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-07T19:54:17.703Z
Answers.LastActivityDate: 2018-08-07T19:54:17.703Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>Settings definitions allows for a field "on_change". Can anyone explain how to use this? I would like to have it execute a function that I have defined in my extension when my quickform is saved. </p>
  
  <p>THanks!</p>
  
  <p>Documentation Referenced: <a href="https://docs.civicrm.org/dev/en/latest/framework/setting/#settings-definition" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/framework/setting/#settings-definition</a></p>
  
Tags: <extension><settings><quickform>
Title: Settings Definition (How to Use On_Change?)
ThreadText: # Settings Definition (How to Use On_Change?)
  
  (Asked by: username_0 on 2018-08-07)
  
  Settings definitions allows for a field "on\_change". Can anyone explain how to use this? I would like to have it execute a function that I have defined in my extension when my quickform is saved.
  
  THanks!
  
  Documentation Referenced: <https://docs.civicrm.org/dev/en/latest/framework/setting/#settings-definition>
  
  **Tags:** extension, settings, quickform
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-07. Score: 2 | Accepted answer
  
  `on_change` is executed when setting value is changed. You can either set it
  
  ```
   'on_change' => [
     ['CLASS_NAME', 'functionName'],
   ],
  
  ```
  
  Else
  
  ```
  'on_change' => [
    'CLASS_NAME::functionName',
  ],
  
  ```
  
  A good example would be <https://github.com/civicrm/civicrm-core/blob/master/settings/Localization.setting.php#L145>
  
  HTH
  
  username_1
  
  > **Comments:**
  > **username_0**: Is there any way to pass values through this? Or do I need an API call in my function to get the new value for the setting?  
  > **username_1**: functionName($oldValue, $newValue, $metadata, $domainID) {}  
  
  ---
  
  