How to get what the user entered in Contact Form 7 and change it before sending?

How to get what the user entered in Contact Form 7 and change it before sending? I have an input field, when the user submits the data I have to validate it and if there is anything to change, I tried many options but couldn’t find what I need.

For example, user write something, I need to compare it with JS variable, and change it in sending.

For minimal instance:
You need WordPress, plugin ContactForm7, and for JS I used WoodySnippets.
Create Contact Form with two fields and button.

<label>Doesn't need[text* text-564 placeholder ""]</label>
<label>Need[text* text-276 id:myform "5"]<label>
<button onclick="coinsCheck()">
<label>[submit "Submit"]</label>
</button>

and:

<script>
    myfor = document.getElementById("myform").value;
    function coinsCheck(){
        alert(myfor);
        if(myfor !== '6'){
            alert(myfor);
        }
    }
</script>

Here I output the variable, the first time just to know the value, the second time if it is not equal to 6.
But alert shows “null” twice(if snippet above form) or four times “[object HTMLInputElement]” if snippet below the form. And in console I have this error: Failed to load resource: too many HTTP redirects: http://1.gravatar.com/avatar/459d16a800ceb49fe2871a22c7041252?s=52&d=mm&r=g