Java function not working/on submit?

https://pastebin.com/NgiR5EvW

The function is not being used/called at all. I have purposely entered a blank space in my form, then clicked on submit button, hoping that would trigger the function to kick in but, absolutely nothing. It is as if the script was not there at all. I am at a loss here guys.

You need to read more about the preventDefault method.

Hi there @Tokugawa
Looking at your code and making some testing cases, I found out that you have a typo. When you are grabbing your element value in this line of code.
var userSearchTerm= document.forms.["searchBox"]["searchTerm"];
you have a dot in the forms, followed and then grabbing the element.
That is the reason why when you click on the submit button, wont see the element and just simple move to the linked page. Hope it helps.

I like that you are using pure plain, vanilla JS. its good to know the grass roots :slight_smile:

what @RandellDawson is saying would be a good idea to actually take a look at PreventDefault() will help you a lot not to move any link randomly anywhere.