Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4954 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Howdy, all:

I'm trying to create a script trigger so when a user enters lowercase text into a two-letter State (text) field FMP will change the text to uppercase.

The problem is users will unconsciously enter the state's identifier in lowercase so it'll "stick" in the field instead of the uppercase ones already set up in the value list. I don't want to change the field to a pop-up menu since that'll be unsightly and unwieldy with such a long list (states plus US possessions and Canadian provinces.) Before tweaking, I had it set up so the user received a custom dialogue message that he or she should use only uppercase letters but that was kinda clunky; I'd rather have FMP automate the change. I tried using the command, Upper, by itself but it "masks" the text to look like uppercase--the original text remains in lowercase.

I'm close but not quite there. (See the attached) The first letter is changed after I enter the second letter of the two-letter abbreviation but the second letter isn't changed unless I enter a third letter. Not good. What do I need to tweak the script so the second letter is automatically capitalized?

Pee Ess: I thought of using OnObjectModify instead of OnObjectKeystroke but since there's a tab order set up in the layout what happens is that the following field's (ZIP code) text is changed to the State's text. Not good, either!

TIA for your help.

test.fp7.zip

Posted

Your script never exits as false - so the keystroke is eventually passed to the field. However, this happens AFTER the script has run. At the time you re-insert the field's contents, it's all the characters you have typed so far - NOT including the captured keystroke.

Wouldn't it be simpler to auto-enter a correcting calculation?

Posted

Try this file, I used a simple custom function to make it uppercase

Howdy, all:

I'm trying to create a script trigger so when a user enters lowercase text into a two-letter State (text) field FMP will change the text to uppercase.

The problem is users will unconsciously enter the state's identifier in lowercase so it'll "stick" in the field instead of the uppercase ones already set up in the value list. I don't want to change the field to a pop-up menu since that'll be unsightly and unwieldy with such a long list (states plus US possessions and Canadian provinces.) Before tweaking, I had it set up so the user received a custom dialogue message that he or she should use only uppercase letters but that was kinda clunky; I'd rather have FMP automate the change. I tried using the command, Upper, by itself but it "masks" the text to look like uppercase--the original text remains in lowercase.

I'm close but not quite there. (See the attached) The first letter is changed after I enter the second letter of the two-letter abbreviation but the second letter isn't changed unless I enter a third letter. Not good. What do I need to tweak the script so the second letter is automatically capitalized?

Pee Ess: I thought of using OnObjectModify instead of OnObjectKeystroke but since there's a tab order set up in the layout what happens is that the following field's (ZIP code) text is changed to the State's text. Not good, either!

TIA for your help.

trial.zip.zip

Posted

Ah, thank you both!

If there's one thing that's constant in the universe it's that I will find the most complicated, Rube Goldberg-ish way of constructing a calculation or script.

Oh well, everybody has a skill...

This topic is 4954 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.