Form not submitting

Need help with something HTML related, this is the place to ask.
Post Reply
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Form not submitting

Post by ExtremeGaming »

So, I have created an extra spam prevention feature to rule out most basic spam bots. Using a text field with display none. The problem is, it works fine with JavaScript enabled, but with it disabled, the form does not submit, as though it was being blocked by JavaScript...but it's disabled. However, as soon as I remove the field, the form submits.

Here is the form code (if you need more let me know). I honestly can not see what could be wrong.
<form method="post">
	<input type="text" name="token" value="" style="display: none;" />
	<input type="text" id="chat_text" placeholder="Enter Message..." maxlength="250" name="chat_mes" />
</form>
<?php while(!$succeed = try()); ?>
User avatar
Helx
Posts: 350
Joined: Thu May 17, 2012 6:45 am
Location: Auckland, New Zealand

Re: Form not submitting

Post by Helx »

In the <form> tag put: action="".
This will submit the form to the current page.
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Re: Form not submitting

Post by ExtremeGaming »

Even without the action it would work. But just for kicks I tried it, and it also did not work.

Edit: I'm an idiot. I forgot forms that use an enter key to submit also require a submit button. Due to my usual handling the form submission by enter key with javascript, I never needed one.
<?php while(!$succeed = try()); ?>
Post Reply