PDA

View Full Version : Form Submitting only once



Darkangler
10-30-2007, 12:22 AM
How can I make a form to only submit once in this code?

<form name=form1 form method=post action=main.php?action=chat>
<SELECT NAME="chatid">
<OPTION VALUE="normal">Normal
<OPTION VALUE="emote">Emote
</SELECT>
<input type=text name=msg size=55> <input class=button type=submit value=CHAT ondblclick=disabled=true>

It's for chat so I can't change pages, and it only happens when they either hit enter twice or the page refreshes.

djr33
10-30-2007, 04:00 AM
I'd use Javascript. This isn't a security issue, so it doesn't matter if they find a way to get around it, but just to stop them from submitting by accident.
When you send it, set var disabled = 1; in Javascript; check this value with Javascript onSubmit to see if it works; when the data in the field is changed, just make disabled = 0;