2
Here’s an example of how the form is, it’s much more complex than that, it’s almost 10 years old and I don’t have time to modify everything. But I need to have access to the form inside the other, ie the form with id='form2'.
<form action='pagina1.php' method='post' id='form1'>
<input type='text' name='teste' value='teste'>
<input type='submit' name='enviar' value='enviar'>
<form action='pagina2.php' method='post' id='form2'>
<input type='text' name='teste' value='teste'>
<input type='submit' name='enviar' value='enviar'>
</form>
</form>
Ways I have tried to access this form to send it:
- By clicking the most external subimit button it send the form 1.
- Creating a button in form2 with onclick and calling a javascript function passing as parameter an this.form it identifies the form 1.
- giving a Document.Elementbyid("form2"), it simply does not find my form 2.
- But when I give a Document.Elementbyid("Form1") it returns the form 1.
someone knows why this is happening and how to solve this problem ?
some specific reason to put one form inside the other?
– andrepaulo
There are syntax errors in your code:
'name='enviar'
, there is a character'
before the attributename
that compromises the rest of the code. Fix this. Highlighting the previous comment: it is not very logical to create a form within another (in my view).– Woss
No, as I said it has 10 years of use, and at the time I did not work here, now why do so do not know the need, for the vision I have here would not need...
– Lucas Lima
then Oce already has his answer man... separates these two forrms..
– andrepaulo
No, you can’t have forms nested
– BrTkCa
I separated the two forms, I put one below the other there it worked. Thank you guys very much !
– Lucas Lima