# Stop information from being sent

**URL:** <https://community.hubspot.com/t/stop-information-from-being-sent/91005>\
**Category:** APIs & Integrations\
**Tags:** forms, professional\
**Created:** [October 3, 2023, 4:03pm UTC](https://community.hubspot.com/t/stop-information-from-being-sent/91005 "2023-10-03T16:03:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abiam](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@abiam](https://community.hubspot.com/u/abiam)\
**Post date:** [October 3, 2023, 4:03pm UTC](https://community.hubspot.com/t/stop-information-from-being-sent/91005/1 "2023-10-03T16:03:18Z")

</div>

Hi! I’m trying to customize my form with some tweaks, and the last one I need to work is that, when the contact meets one of the three validation conditionals, the form needs to be stopped from sending the infos to hubspot.

The code I already have is this one. I’m using wordpress + elementor combo, and the form show up as a popup when clicking on a button on the page.

Any help is appreciated!!

\<div id=“formTarget”\>\</div\>  
\<script charset=“utf-8” type=“text/javascript” src=“[//js.hsforms.net/forms/embed/v2.js](https://js.hsforms.net/forms/embed/v2.js)”\>\</script\>  
\<script\>  
hbspt.forms.create({  
region: “na1”,  
portalId: “39782198”,  
formId: “8ff9e15d-62da-428a-bc2f-ababa33907e7”,  
target: “#formTarget”,  
onFormReady: function(jQueryform) {  
// Adicione um ouvinte de evento de envio do formulário  
jQueryform[0].addEventListener(“submit”, function(event) {  
var qualificacao = jQueryform.find(‘select[name=“aposentado\_ou\_pensionista\_”]’).val();  
var diagnostico = jQueryform.find(‘select[name=“diagnostico”]’).val();  
var salarioBruto = jQueryform.find(‘select[name=“salario\_bruto\_de\_beneficio”]’).val();

console.log(qualificacao);

if (qualificacao == “Nenhuma das opções” || diagnostico == “Outra Enfermidade” || salarioBruto != “Até R$3.500,00”) {  
// Impede o envio padrão do formulário  
event.preventDefault();

// Desativa e oculta o botão de enviar  
jQueryform.find(‘[type=“submit”]’).prop(‘disabled’, true).hide();  
// Adiciona um botão de fechar  
var closeButton = jQuery(‘\<button class=“fecha-janela”\>Fechar\</button\>’);  
closeButton.click(function() {  
// Fecha a popup  
jQuery(‘#elementor-popup-modal-466’).hide();  
});  
jQueryform.append(closeButton);  
// Exibe um alerta personalizado  
alert(“Infelizmente você não cumpre os requisitos para receber o benefício.”);  
} else {  
// Lead qualificado, redireciona para a página de obrigado  
window.location.href = “[https://google.com](https://google.com)”;  
}  
});  
}  
});  
\</script\>

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 5, 2023, 5:07pm UTC](https://community.hubspot.com/t/stop-information-from-being-sent/91005/2 "2023-10-05T17:07:40Z")

</div>

Hey, @abiam 👋 Thanks for the interesting question. Did you get any closer to finding the root issue?

If not, have you tried:

- Have you tried using `console.log()` statements to print the values of `qualificacao`, `diagnostico`, and `salarioBruto`? To verify the values checked are what you expect to see.

- Have you tried wrapping this inside a `window.onload` function or jQuery’s `$(document).ready()` function? To make sure everything is loaded before your script runs.

Thank you for the additional details! — Jaycee
