I was approached by a gentleman seeking estate documents [Wills, Powers of Attorney ("POA") and Personal Directives ("PD")] for himself and his wife, who was hospitalized with a terminal condition. I took instructions, completed the documents and attended at the hospital so they could be signed. However, when I spoke to the wife, I immediately realized we had a problem - she did not appear to have the legal capacity required to validly sign the documents.

What's required for a person to have the "legal capacity" will vary depending on the act to be performed. However, in general terms, in order to execute legally valid documents, you must have a certain level of competency. You must have the ability to understand the information relevant to making the decision and the ability to appreciate the reasonably foreseeable consequences of the decision or lack of decision.
Unfortunately, mental competence can become an issue if a person’s ability to think clearly is affected by illness, drugs, or pain. This is why it's critical that Wills and other estate documents be completed while you are in good health so that there are no questions as to your mental competence.
I felt bad for both parties but it emphasized how important it is to prepare such documents before it is too late.
Note to yourself: there's a good chance it will be "too late" to proceed with such documentation when you already have a terminal diagnosis.
This is especially so when you consider leaving assets in a Will to a beneficiary whom is challenged.
For more information on the standards required to execute valid estate documents, please follow the link.