Jump 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.

? Auto scripts when choosing a pop-up list value ?

Featured Replies

Hi everyone,

I would like to create a script that would automatically take the user to a new layout when they select a certain value from a pop-up list.

For example if they choose "Summary Data" from a pop-up list, FM would open the "SumData" Layout for further data entry. From what I've been reading here in the forum it seems that I may need a plug-in to do this. Does anyone have any other solutions?

Thanks in advance,

Kel

Hello Kel,

if your list is short (10 - 20 items) you can accomplish your job by using a pop-up menu instead of a value list: pop up menu is 'scriptable' while a pure value list is not.

If you don't fall under this case, you need a plug in: take a look to the 'EVENTS' plug in at www.wmotion.com.

Regards

  • Author

JPaul,

Thanks for responding, I have a further question regarding your solution. How exactly do I attach a script to the pop-up menu? Is this in Define Fields, or do I need to add a button that the user has to press to run the script? I was trying to avoid the latter solution. Thanks for you help,

Kel

You have to follow these steps:

  • define a field containing your list (as pop up menu) and buttonize it by attaching to it the script you need to be executed.

  • obviously this trick does work only by clicking on this field and not tabbing in it.

If you need an automated execution of the script (without clicking) you need the plug in i've mentioned in my preceding post.

There are other ways to accomplish this job but are more sophisticated and very tedious and complicated, such as launching (at the 'form load time') a script that drive the navigation between the fields on the layout !!

Do you are ready for this ?!

I think the pop up menu and / or the pkug in are the better (and simply) ways.

Greetings for Holy Lands.

  • 3 weeks later...
  • Author

JPaul,

Thanks, I opted for the pop-up menu option which didn't work out exactly because it would require the user to first select an option from the pop-up menu, then re-click on the field to activate the script.

What I did instead was to create a transperent button under the next data entry field on the layout. This too created a slight problem when you clicked on the field because it would run the script and not give you the pop-up options for data entry. So I made the transperent button cover the field only partially, that way the user will usually activate the script first when they click in the field, then try clicking again to get the pop-up menu to come up. It is sort of an archaic solution, but it works for me!

Thanks again, kel

quote:

Originally posted by kel:

JPaul,

Thanks, I opted for the pop-up menu option which didn't work out exactly because it would require the user to first select an option from the pop-up menu, then re-click on the field to activate the script.

What I did instead was to create a transperent button under the next data entry field on the layout. This too created a slight problem when you clicked on the field because it would run the script and not give you the pop-up options for data entry. So I made the transperent button cover the field only partially, that way the user will usually activate the script first when they click in the field, then try clicking again to get the pop-up menu to come up. It is sort of an archaic solution, but it works for me!

Thanks again, kel

Hi Kel,

don't worry: if your solution does work right for you don't care if it archaic or not !!

I think, also, you have misinterpreted the contents of my post: to clarify it send me your e-mail address and i will send you back and example (naturally if you agree).

Best regards

  • 3 weeks later...
  • Author

With a big help from JPaul who sent me a FM file with a scripted pop-up menu field in it, I was able to figure out how to "buttonize" values in a pop-up menu field so that they will take you to different layouts. Check out the steps below to do this yourself!

Step 1. Define the field you want to attach a script to.

Step 2. Create a Values List for the field including the values you want to "buttonize".

Step 3. In Layout mode, using Field Format, make your field a pop-up menu and attach your values list to it.

Step 4. Write your script, here is an example:

Go to Field [“My Pop-Up”]

Pause/Resume Script [“0:00:02”]

If [“My Pop-up”=”A””]

Go to Layout [“Form A”]

Else

If [“My Pop-up”=”B””]

Go to Layout [“Form B”]

End If

End If

Step 5: Attach the script to your field and choose "Resume" current script.

Now when you choose a value from your pop-up menu, FM will automatically take you to your desired layout.

Thanks JPaul!

-kel

Hi Kel,

a little comment; set Pause/Resume to 0 (instead of 2): it pauses the script for about 1 sec. and give it the ability to process the remaining instructions after the 'setfocus' (go to field) is done.

Best regards.

JPaul,

I use exactly the same method for switching layouts/executing scripts & this works perfectly on a windows platform. However, I have a problem getting the Pause & menu to appear on the Mac - It simply seems to skip throught the script & close.

Hi Mattc,

i have no knowledge about Mac world, but do you can be more specific about your concern ?

Greetings

quote:

Originally posted by MattC:

...However, I have a problem getting the Pause & menu to appear on the Mac - It simply seems to skip throught the script & close.

I find this very hard to believe as I work with both Macs and Windows machines and have never noticed anything like this.

Precisely the solution I have been trying to figure out! Thanks!

A wealth of knowledge here for the looking...kudos to all who share their talents and experience in the forums.

  • 11 months later...

Sorry about this!

I've just come back to my project and am still having trouble with this solution.

I find that when using this method on a mac with a pop up MENU that the user has to click the field/button twice to get the menu to appear in order to make a choice. I can get a similar script to work with a pop up LIST but not the menu. I prefer the pop up menu as it blends with the OS X theme - any ideas??

By the way, this script works faultlessly when running on a FM5 client on PC.

I am using FM5.5 in OSX if this makes a difference.

Thanks

Matt

Create an account or sign in to comment

Important Information

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

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.