-1
I have a form that changes its name constantly , and I want to give it Ubmit for a function. In this function "alters" it takes the name of the form, but this way I did it does not work. The "+ide+" form is a random number, so I pass it to the "alter" function. If anyone can help me and explain how to make it work what I want to do.
<form method='get' action='GG.php' name='alteracao"+ide+"'>
<button onclick='altera(alteracao"+ide+")'>Enviar</button>
</form>
function altera(ide){
document.ide.submit();
}
There’s a
'
missing in onclick. Other than that, I don’t understand what you’re trying to do. Where does the name of the form that always changes come from? Are you trying to figure out what the name is or trying to invent a new random name?– Victor Stafusa
This ' I forgot when I wrote here. This "+ide+" it always changes, for example, it can be "alteracao10" or "alteracao55". But my doubt remains being in the function itself, it works by putting Document." ide". Submit(); where this "ide" is the parameter that mimes function receives?
– Douglas
But with you does the interaction on this "+ide+", is already coming from somewhere?
– LeAndrade
How are you generating the Formulars ?
– codermarcos
This "+ide+" is generated by the database with an Autoincrement, @Leandrade
– Douglas
The
+ide+
is replaced by a number only on the tagform
or it’s also on the tagbutton
?– Victor Stafusa
The forms are generated by a createelement + innerHTML. That createelement creates the place where the form will appear and innerHTML places the form already pre-created in javacript. @Marcosjunior
– Douglas
@Victorstafusa on the button tag the +ide" is only used to send the parameter in the function, thus sending the exact name of the Form.
– Douglas
In that case would not only take the value of the name? Because the name no longer goes with the value of the bank?
– LeAndrade