I want to conditionally validate the presence of a text field based on a radio button i.e. it is a yes/no radio button, and if "yes" is clicked, then a text field has to have a value. To do so, I wrote the following script in the Script Editor for the text_field and chose the "validate" option of the "Show" dropdown :

Thanks for the reply. Unfortunately, it does not work either. There seems to be a problem when the text field is empty. It is like the validation is not performed when the text field is either left empty or erased.

As a test, I initialized the radio and text field with different combinations and I also initialize another text field of the form with the value of the test. This field correctly displays either True or False, even when the first text field is empty.

I am not completly sure to have understood you right.
Some questions for better understanding.

1) Do you want to validate the textfield WHEN you click the button (that means if it is empty a message appears when you click)
2) Do you want a user to be able to change the textfield entry but not erase it?
3) Do you want to make a validation before sending the mail? So the field simply gets obligatory but has not to be filled out the moment the user clicks.

4) Did Paul's solution work somehow? Or could there additionally be a value/naming problem? (Just to make sure)

I think the main reason you are not satisfied is, because you only put the script into the change field of the RB.

1) I want to validate upon submission of the form (via http, not email)
2) I want the user to be able to edit the text field (fill, modify, erase, etc.)
3) I want to make sure that if the radio button is set to "yes", then the form cannot be submitted unless the text field has been filled
4) unfortunately it did not work.

I use LiveCycle Designer 8.05.2073.1.374024 Cipher: 128-bit. In the Script Editor, I added the following javascript test :

I just had an idea. Instead of testing for nullity and/or emptyness of the text field upon submission of the form, I could make it mandatory upon clicking the "yes" radio button (and revert upon clicking "no"). So my question is: how do I do that, make a text field mandatory via javascript ?

Acrobat/Reader will run validations automatically for you and not allow you to submit unless these validatiion conditions are met. In your case the field starts off as open and based on a condition you would make it mandatory. So we merely have to make the field mandatory (under the right conditions) and allow the submit logic inherent in the client to work. So on the change event of the checkbox you can do something like this: