I had the following problem when I submitted my form using jQuery FORM and did a POST submit.
When I enter an HTML comment in the input box:
< !--
The request is never sent, and it waits forever.
I believe the reason is that the HTML comment destroys the XMLHttpRequest object and is never processed by PHP. I can just parse the html comments from the input fields before submitting, but something tells me that this is not the best solution to solve this problem. Does anyone know a better solution to avoid this problem?
The HTML code for my form is as follows:
<form method="post" action="/orders/place" class="form a-center" id="orderForm"> <input type="text" x-webkit-speech="" value="Sign text" name="sign" id="sign"> <textarea rows="7" name="comments" id="comments">Order comments</textarea> <p> <button id="orderSubmitBtn" class="button" type="submit"> </p> </form>
Javascript is a simple representation of a jQuery form:
var options = { dataType: 'json', success: function(data) { if (data.ok) {
The only time it fails is when I entered the html comment tag.
There is also a link to a page containing the form http://sandsign.com (just try entering <! - text in the character text, click the Lets Go button)
source share