17

So I answered a question, It may not have been 100% directly answering what he was asking but I still felt it was relavant. He was asking about logic to prevent a form from being submitted if a field was empty. To me, this is the job of a validation library, jQuery.Validate is very common and built into MVC and it is the one I am use to working with.

My answer,

Are you using jQuery validation?

var frm = $('form')

frm.validate();
if(frm.valid())
{
    // Do AJAX
}

That will help validate your form on submit.

I could have perhaps been more forward with my answer and stated "I am not sure if you are using a validation library or not but if you are using jquery.validation here is a code sample you could use.

To me, the answer I provided was more asking if he was using it so he could let me know if he was using it, and if he wasn't I could further assist but just incase he was using it I wanted to provide him with the answer immediately so I did not have to come back and add it.

Unfortunately I received this comments on my answer and 2 down votes.

Please do not post questions as answers.

and

Your question would have stood without code. And you could have posted limited code with some markdown.

Did I really do something wrong? I was simply trying to be proactive in giving an answer that would have worked for him if he was using it, which in the end he started asking about it. The experience I had with this post really make me hesitant on sharing my knowledge as I feel at time people are to "Hard Core" on this site.

I deleted my answer, should I have? And is what I did really all that wrong?

I did get a little upset so please pardon my comments if they seem a little crude.

Allow AJAX Post on.click if a field is not empty?

5
  • 4
    The OP just made a stoopid mistake, forgetting to use parentheses in his if() statement. Your answer was a bit like you taking your car to the garage because the exhaust backfires. And the mechanic telling you to buy a new car. Yes, that answer works, nobody is going to be very happy with it. Commented May 29, 2014 at 14:39
  • possible duplicate :<meta.stackoverflow.com/questions/256350/…>
    – Tony
    Commented Jul 6, 2014 at 3:13
  • 1
    I would not consider that a duplicate. The context isn't even the same.
    – Tony
    Commented Jul 6, 2014 at 6:10
  • 10
    at first glance it looks as though you're arguing with yourself about that duplicate
    – aw04
    Commented Nov 21, 2014 at 20:45
  • 3
    Perhaps the first line of your answer would have been better if started with "If you using jQuery validation ...".
    – AdrianHHH
    Commented May 2, 2015 at 16:29

3 Answers 3

15

To answer your question, strictly; if downvotes have caused you to question the usefulness of your answer - and you can't improve it - then yes, you should consider deleting it. I'm not going to tell you that you have to, though.

That said, about your specific post:

I think your answer counted as "barely an answer" when you include the code, but you did start off with a clarifying question. Ideally, I might have asked that question in a comment, first, then considered posting relevant code.

So, even assuming they are using jQuery validation, you might have wanted to include a bit more information, in particular related to the specific code the person had.

22

Well, as a rule, I personally discourage anyone from deleting an answer that they don't personally feel is bad and don't recognize as being unhelpful. If you delete the answer you are removing the opportunity to figure out what you did wrong, so you'll continue making the same mistake in the future. Having a downvoted answer is an amazing learning opportunity for you; I have never learned more on this site than by posting a wrong answer and having it be corrected.

Once you understand exactly what you've done wrong, or at least what other readers felt you've done wrong, you have a few choices:

  1. You can fix the problem, making the post a good post. This is obviously the best possible situation. There is no need to delete the post if you can fix it.

  2. You may disagree that the problem is a problem, even if you understand why others feel your post isn't helpful. If you feel your post really is helpful, then it's up to you if you want to delete it or not. Personally, I generally don't, because if I feel my answer is useful or helpful I want other readers to be able to read it, regardless of its score.

  3. You may agree that the post isn't helpful, and be unable/unwilling to fix it. This is where deletion is the best option.


As to your specific post. Based on the comment, it would seem that the primary problem with your post is that your "answer" isn't an answer. It's request for information, as per your own comment:

as far as I am concerned I did not have enough information so I was simply asking [...] I would have posted as a comment [...]

So your post should have been a comment. You know it should have been a comment, the readers knew it should have been a comment, but you posted it as an answer anyway, despite the fact that it's not one.

You shouldn't post comments as answers, and deleting a non-answer posted as an answer is for the best.

1
  • That might be well and good for users with a lot of Reputation in the bank, but when they see the price of leaving the post there will soon get all their Reputation used up, due to downvotes piling in more and more each day, they will panic. Commented Oct 7 at 1:44
2

In regards to your general question I once got an answer that turned out to be very incorrect, but it illustrated a misconception that many others likely had. Someone corrected that poster and we all learned something from it. I asked them to let the answer stand for the sake of thorough discussion and they did, despite it getting negative votes. They lost some rep but they gained my respect and other folks undoubtedly gained knowledge from it.

It's sometimes just a matter of what's more important to you - the good of your rep score or the good of the site.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .