0
I have the following function that sends a form:
function enviar_formulario() {
document.search.submit();
}
When I want to call the function I do so:
<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 the form
has to be under the name of search
.
How to pass the name of the form to be sent to the function?
Example:
enviar_formulario(nome_do_formulário_a_ser_enviado)
You can show the form and button HTML?
– Sergio
Actually it’s not a button, it’s a select, and when I change the value it has to submit the form. I’ll put it in my question.
– Hugo Borges
@Hugoborges You want to pass this code to Jquery and also use a mode as parameter ?
– Mauro Alexandre
@Mauroalexandre put in pure JS because I don’t know how to do in Jquery hahahaha. Yes and that’s just what I want.
– Hugo Borges
And where does the form name come from? By select options are fields.
– BrTkCa
then I want to inform the name when I call the function
enviar_formulario(nome_aqui)
o formulate this thus<form name='nome_aqui'>
– Hugo Borges