I need to display text field to Uppercase, using Rewrite Results in Views. For example from the text value "paper Title" to "PAPER TITLE".

How to transform the text to uppercase in Rewrite Results?


One solution is to rewrite with inline CSS styling. For example:

<span style="text-transform: uppercase;">[my_field]</span>

Depending on your design needs you might want use CSS classes instead.

  • I tried this but does not change the text to upperase. I can change the text by using simple tags; <em></em>, <strong></strong>. Is there any setting to use <span> tags. – Waluyo Adi Siswanto May 23 '15 at 23:38
  • 1
    This idea also works with modification. In the Rewrite Output <div class="changetoupper">[value]</div> then in the theme style.css add .changetoupper {text-transform: uppercase;} – Waluyo Adi Siswanto May 30 '15 at 15:53

Thx @Waluyo

Needed to deal with URLs in taxonomy term names for a CSV data export, so this worked great for the output to create lowercase and insert the dashes:

<?php echo strtolower(str_replace(' ', '-', $row->name)); ?>

(Value code for my situation was $row->name)


I don't see this question specifically tagged as D7, so if someone is using D8 and sees this question, Twig would be an easy way to accomplish this:

{{ my_field|upper }}

A possible solution is to use the views feature "rewrite result", combined with Views PHP module.

Note: this module only has an alfa version as of today, but it's used in over 71K sites anyway.

  • I have installed Views PHP. Then I add field Global: PHP. What the codes in "Value Code", "Output Code" and the code in "Rewrite Results (Rewrite the output of this field). – Waluyo Adi Siswanto May 24 '15 at 0:43
  • Oppps sorry. Now I can change the field to Uppercase in Global: PHP. In "Value Code" $row->value, In "Output Code" <?php echo strtoupper($row->value); ?> . Thanks for the suggestion. It works. – Waluyo Adi Siswanto May 24 '15 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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