I have two fields in a content type. one is file upload field. another one is link field. Customer can either upload file or give the url to the field.

so I want to display "(OR)" between these two fields in content type.

How this can be achieved.

2 Answers 2


If you simply want to display "(OR)" between two fields in content type, you can achieve this in form alter

function modulename_form_alter(&$form, &$form_state, $form_id) {

    if ($form['#id'] == 'page-node-form'){ //contenttype-node-form

   $form['field_test']['#prefix'] = '<div class="classname"> OR';
       $form['field_test']['#suffix'] = '</div>';
       //where field_test is your file upload field

I think you are trying to present your customer two options with radio check box - Upload file or Web Link. Upon selection of one of those fields, you would display the respective field - field upload or link.

If you love custom coding, you can do it with custom module with #ajax attribute on the radio field to alter and rebuild the form.

Check this answer for your reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.