Testing a change of state

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 27, 2014   (RSS)

Hello, All

Is there a simple way to test for a change of state in a value?

Say I have a record set-up with a checkbox for registering for a newsletter. I want to trigger an event (send an email) when the user changes the state of the checkbox. The value (yes or no) only determines which version of the email is sent.

Any tips would be most welcome!

:0)

Perch

By Dave - November 27, 2014

Hi Perch,

Would they be changing it in the CMS or on a front-end web form?

If it's in the CMS, you can right a plugin for it.  There's a plugin hook called 'record_postsave' that passes you the $oldRecord.  So you can check what the previous value was.

If it's in a front-end form that lets the user update the checkbox, you need to check for an existing value before saving the new one, and then you can trigger actions based on that.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com