I answered how to default value to select list CCK with form_alter earlier, and noticed in the related section a bunch of questions following the same patter regarding CCK and hook_form_alter().
So I answered hook_form_alter selecting a default value in a node reference select list, but then I felt that there are a lot of answers on this precise topic that are incorrect so I can go on and on and provide a lot of similar answers. Of course I adapt my answer a little and actually write code and test it to be 100% sure it is working.

  • Is this bad behavior?
  • Should I down-vote the incorrect answers (which then may favorites mine)?

As far as you don't copy and paste the same answer of yours, and you use it where it effectively answer the question, then there isn't anything wrong. For example, if in a question asking the difference between two modules, you answer reporting a snippet you used, then the question is probably not appropriate.
There could then be the doubt that questions that require a similar answer could be duplicated, but that is a different topic.

You can down-vote an answer that is wrong, or not useful. The system is already thought to avoid a user down-votes an answer just to favorite his own answer, and then remove his down-vote. I personally prefer explaining why the other answer is wrong in my answer to that question.

  • For my seoncd answer I slightly adapted the snippet but kept the context regarding #after_build. Regarding down voting I'm not very fond of it as it can be seen as "punishment" so I'll wrote a little comment (also errare humanum est and sometime I answer to quickly and it sucks to be punished). Thanks for the highlighting, I've seen the post by Jeff but never managed to get it working, I was missing the lines ;) Thanks a lot, great answer as usual. Go for the 10k ;) – tostinni Aug 8 '11 at 16:36

This is OK, so long as

  • the answer is correct for each question

  • the answer is specific to each question

Blindly copying and pasting is generally bad. If a copy-pasted answer works for multiple questions, it implies that those questions are duplicates and should be closed as such!

  • They're was a little variation in the question that allowed me to use almost the same snippet, so I adapted it and reused it. – tostinni Aug 8 '11 at 16:30

You must log in to answer this question.

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