May 1, 201114 yr 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
May 1, 201114 yr 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?
May 2, 201114 yr 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
May 3, 201114 yr Author 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...
Create an account or sign in to comment