Clear search field in onvalid

I’ve spent several weeks trying to find a way to clear the advanced search field, after validating the field in the grid’s advanced search.
I call the function limpa_form() and it works but from a button.

I need the Limpa_form() function to be executed after validating the field, but apparently this function cannot be called from the onvalid event of the advanced search.
I appreciate your help friends