Hello All,

I've created a content type which has some simple CCK fields, mostly just text fields. I've re-named the title to Serial Number, since Drupal requires that the title be unique. However, I cannot figure out how to force the title field to save/display in upper case only.

Anyone have any ideas?

Thanks,

Comments

andrewtf’s picture

You could use CSS to make the field display uppercase only. Use the declaration "text-transform: uppercase;".

Steel Rat’s picture

Thanks for the reply.

I'd rather have it saved to the database that way. I supposed I could alter the field in the DB, but not sure what problems that may cause Drupal.

clintcar’s picture

using a custom module, i got this far. it limits how many characters can be entered at 7, but i wish it forced uppercase for my serial numbers. any PHP ninjas got an easy fix?
something like:
$form['title']['#text-transform'] = uppercase;
?

function theme_form_alter(&$form, $form_state, $form_id) {
	if ($form_id == 'serial_number_node_form') {
		 $form['buttons']['preview'] = NULL;
		 $form['title']['#maxlength'] = 7;
	}
}
Steel Rat’s picture

What are you using to generate serial numbers?