Formatting text fields

Ok. I have what is probably a really stupid question. But I have several fields that users enter data however they like (uppercase or lowercase).
How do I display it in all uppercase dispite how the user entered the data?
In the format box for the field in question, I called the following formats: UUU|raw or U|raw.

With the first it gave me only three of the uppercase letters that were entered that way.
The second gave me only one of the uppercase letter that were entered that way.
I want all letters uppercase no matter if they were entered in uppercase or lowercase.

What am I doing wrong?

Thanks.

In the javascript library, there is a string method called toUpperCase().

var text = elements.textfield.getSelectedText().toUpperCase();

should work

But this is not in a method. It’s the field on the form.

I’m not sure about just displaying the text in uppercase. But to store (and by default, display) the text in uppercase you could attach an onDataChange triggered method with the code suggested above.

myField = myField.toUpperCase(); 

What happens when you do ‘UUUUUUUUUUUUUUUUUUUUUUUUU|raw’? Where you add the # of U equal to the field length?
Or is that no option?

Hi Jim,

I assume you want a FMPro-like formatting on that field. So whatever people type in it is shown uppercase but it is stored unaltered, am I right?
I have done some testing and Servoy doesn’t have such a feature for upper/lowercase.
Using the U or L operator you can only type/display alpha-numeric values. No spaces, no hyphens, no numbers, etc. although the help states it allows any character. And the field also requires the exact amount of characters typed in that match your amount of U’s.
On top of that even if you use the raw operator it will store it all according to the U/L format.

So using the format property won’t get you what you want.

Now if you wanted to show the uppercase values on another form instead that I suggest you create an unstored calculation that uses the toUpperCase() function.

Hope this helps.

I had the same problem and solved it this way

created global methods -

converttoProper

var fieldname = application.getMethodTriggerElementName()
var frm = application.getMethodTriggerFormName();
var contents = forms[frm].controller.getDataProviderValue(fieldname)

//Returns all words in field starting with Capitals
forms[frm][fieldname] = utils.stringInitCap(contents);

and other global method

converttoUPPER

var fieldname = application.getMethodTriggerElementName();
var frm = application.getMethodTriggerFormName();
var contents = forms[frm].controller.getDataProviderValue(fieldname)

//Returns all words in uppercase
forms[frm][fieldname] = contents.toUpperCase();

then call these global methods On Data Change on any field on any form you want to control the format.

Seems to work
but bear in mind I am a Sevoy junior and may be missing something
hope thats helpful
Roger

Robert is correct. Being a former FMP Developer I am trying to get a field to display uppercase all the time like Filemaker does.
I will try Roger’s idea and see how it works.

That worked, and it does exactily what I want it to do.

Thanks guys.