1

I'm trying to create a custom signup content type and I'm wondering if there is a way to check if two email fields have the same value entered. Similar to typing in an email twice to make sure you have the correct email down.

If the two email fields are not the same an error needs to appear upon saving.

I'm not using a webform for this, it's a custom content type.

1
  • You can do it with the help of form alter and ajax. You just need to alter the form and add for both field and validate field on change event.
    – Prem Patel
    Nov 17, 2017 at 2:56

1 Answer 1

0

Assuming this question is about D7, you could use the Rules module and create a (rather basic) rule like so:

  • Rules Event: Before saving content
  • Rules Conditions:
    • Content is of type "custom signup".
    • Entity has field (related to your 1st eMail field).
    • entity has field (related to your 2nd eMail field).
    • Data comparison: the value of the 1st eMail field is NOT equal to the value of the 2nd eMail field.
  • Rules Action: Show a message on the site (of type "error").

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.