Always uppercase a field value

Hi.

I am very new to frappe.io and ERPNext. I want to create a field in the docType which converts all letters to uppercase. What would the best approach be to that? I can convert the value in validate function on the server script. Also I want to apply a style “text-transform: uppercase” to the input. How can I easily get the element from DOM in client script? I tried this:

> frappe.ui.form.on('Project', {
> 	onload_post_render: function(frm) {
>         $("form>.frappe-control input").css("text-transform", "uppercase");
> 	}
> });

This works but only in full page form. It does not work in modal form when I click the “New” button. To me it doesn’t look very elegant and I would like to address the element by field name somehow.

Many thanks
Regards
Darius

1 Like

You can convert the input to uppercase on save, on server side. i.e validate method

we cannot address specific field to uppercase ? if can we do can you share code !

@netchampfaris @nabinhait

Can we have any configuration for this?

I’m also new to frappe. I saw a name_case property for fields.

But it only applies for name

can you get soluction for this ?

Write server script and you can use before insert like

if doc.city is not None:
doc.city = doc.city.strip()
doc.city = doc.city.title()

above is removing blank space too

2 Likes

Please refer this
Upper case issue