1

In rules you have the ability to check whether a field in a form has been changed by negating node-unchanged:field-xyz = 123.

I want to check whether a field has changed programmatically with the $form and $form_state.

How would you do this?

2
  • Hey hey, what have you tried so far? And what is your exact question? Please update your post to provide specific problems we can help you to solve.
    – leymannx
    Jan 22, 2018 at 20:03
  • Compare the $form default value vs the $form_state value. If they are not equal, then there was a change. You'll want to do this inside a custom form validate or submit function. Use hook_form_alter to add your custom validate or submit function. See: Custom validation for a form? as an example.
    – No Sssweat
    Jan 23, 2018 at 1:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.