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.