Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

if type in 1 field, lock user out of 2nd field?

Featured Replies

Hello all,

I'm brand new to scripts, have only written one simple one so far. But, that said, I need to create one to do the following, and I don't know where to begin.

I have two fields: zipcode and postalcode

If a US person enters a zipcode, they should be locked out of entering any information in postalcode.

The reverse is also true, if someone enters something in postalcode, they should be locked out of zipcode.

However, if they delete their entry in one, they should be allowed into the other field again.

How can I do this??

Thanks!

-Lynn

Hello, again, Lynn!

It sounds like you're having a blast with FileMaker. This forum (FMForums) is absolutely the greatest for getting ideas about making FMP work for you. I find it better than books... except, maybe a 'select' few.

Anyways... after I 'posted' the 'auto-entry' address ideas in response to your earlier post, I had many direct requests for more information. I decided to create a sample file to show how my ideas functioned. My sample includes a single 'Postal Code' field that can be used for both Canadian and USA postal codes. It is setup to create the appropriate labels based on the data entered.

If you would like to take a look, tear it apart, etc... it is unlocked. Do what you want with it.

You can e-mail me directly at: [email protected]. If you are uncomfortable using your private e-mail address, goto Hotmail.com and setup a temporary e-mail account. I will understand.

Thanx,

Bob Kundinger

You can do this with field validation. For example:

Postcode should be validated by IsEmpty(ZipCode), and display a message that "You can't enter a Postcode until you clear the Zipcode field"

ZipCode should be validated by IsEmpty(Postcode), and display a message that "You can't enter a ZipCode until you clear the Postcode field"

You might also want to add some other validations, based on the known length of postcodes etc.

An easier way, if it is feasible for you, would be to condense ZIP code and Postal code into one field. I'm assuming that if they are US, then they would need have a ZIP Code and if not, its a postal code, right? WEll, you could just have one field, with, instead of a label, a calculation set to look like a label, as follows:

If(Country="USA", "ZIP Code", "Postal Code")

then, set up the validation on the ZIP Postal code to differ, depending upon the value of country, with an if statement. Does that make sense? I like it this way on my layouts because A) it gives the user the illusion that you are contextually changing the form, based on their input, and B) It prevents them from entering where they shouldn't. Another good use for this is in the State/Province field.

Any reason why the zip code and postal code fields can't be the same field?

I like simple solutions, I do.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.