The form does not appear, but its contents

I have this piece of code:

<div> <form name='profileForm' id='profileForm' action='' method='get'> <input type='submit' name='ProfileBtn' id='ProfileBtn' class='buttonC' value='My Profile' /> </form> <br /> <form name='logoutForm' id='logoutForm' action='' method='get'> <input type='submit' name='LogOutBtn' id='LogOutBtn' class='buttonC' value='Logout' /> </form> </div> 

When I conclude the above, "profileForm" does not appear (although the BTn DOES profile appears). the secret form has no problems, which is strange because they are both alike.

This is probably a simple question, but I do not know what the problem is.

+13
html forms appearance
source share
5 answers

Well, then somehow a strange problem with forms arose, the button did not appear, because when I started the site, "profileForm" somehow disappeared (and did not appear in the console). I did the addition of a third form to "profileForm", which somehow solved this.

+8
source share

This happened to me using Chrome because I had a form in shape . It seems like Chrome just removed the <form> open and close tag because my form was in a different form. When I moved one form outside the other, the <form> tags were displayed in html, as intended.
Crackerman also received this in his answer.

It is difficult to give a direct solution without seeing your full html, but I assume this is your problem - you need to make sure that your form is not in another form. A really simple example to illustrate this:

The form is in another form , please note if you run this code in Chrome and check <form id = "form2"> does not appear :

 <html> <head></head> <body> <form id="form1"> <div>form within a form</div> <form id="form2"> <input type="text" placeholder="name" /><br/> <input type="text" placeholder="title" /> </form> </form> </body> </html> 

If you move form2 outside of form1, run the code in Chrome and check , then the form <form id = "form2"> is displayed :

 <html> <head></head> <body> <form id="form1"> <div>form2 moved outside of form1</div> </form> <form id="form2"> <input type="text" placeholder="name" /><br/> <input type="text" placeholder="title" /> </form> </body> </html> 
+26
source share

There is an open HTML tag such as & lt; form> in your code before these lines,

 Find and close that form 

OR

just put </form> in front of your code.

+4
source share

Make sure that you are not an open form element before opening the next form.

If you do, browsers will generate a source without displaying an open form and open a closed pair.

+1
source share

Just put an empty form on top of your form. Then all forms will be displayed with the form identifier

 <form></form> <form name='profileForm' id='profileForm' action='' method='get'> <input type='submit' name='ProfileBtn' id='ProfileBtn' class='buttonC' value='My Profile' /> </form> <form name='logoutForm' id='logoutForm' action='' method='get'> <input type='submit' name='LogOutBtn' id='LogOutBtn' class='buttonC' value='Logout' /> </form> 
0
source share

All Articles