I have the following function that sends a form:
function enviar_formulario() {
document.search.submit();
}
When I want to call the function I do this:
<select name='busca' onChange='enviar_formulario(search)'>
<option value="1">ID</option>
<option value="2">NOME</option>
</select>
And whenever I select the option it sends the form.
Well it works, but form
has to be named search
.
How do I pass the form name to be sent to the function?
Example:
enviar_formulario(nome_do_formulário_a_ser_enviado)