Form with only one input field!
I have made a variety of forms, but I just made one with only one input field type="text". The mysterious case is that when I press enter, the page reloads and places the values in the url!!
Why does it do that, and how do I prevent it???
If I make one more text field it doesn't happens!!
(The form action is not defined because I use ajax to handle the form)
<input type="text" name="testinput">
What are you trying to do with your form? It needs a method and action attribute to know what to do when it is submitted. Since you haven't provided either, it is using the GET method and the default action is to reload the page. That's why you're seeing this behavior.
Hi Big O
Thanks for the reply!
I understand that it by default uses GET method, and that it reloads the page, but why doesn't it happen if there are more then one text field?
Well the quick solution is to place this inside the <form> tag:
Maybe not pretty but it works!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)