Zend certified PHP/Magento developer

Magento 2 message not showing after adding Google Recaptcha

I have developed a custom module for displaying a contact form. On form submission, I am sending an email and redirecting back to the same page with a success message. The message was showing until I integrated a Google recaptcha as described here https://magently.com/blog/recaptcha-in-magento-custom-form/. After that the message is not showing. If I remove the captcha it works. I have added message using below code.

$this->messageManager->addSuccess('Email sent successfully');
$this->_redirect('pricequoteform/index');