Jump to content

Basic "If" statement with dialog


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

Recommended Posts

  • Newbies

I have a music artist contacts database with fields for social media URLs.   On the side of the layout I have image icons (Twitter, Facebook, etc..) that are buttons with corresponding scripts to "Open URL" typed in the fields.  My desire is, if the URL field is empty, the button script can manage a dialog that reads (ex.) "Instagram URL does not exist" and then the user clicks "Ok" then the script ends.  Likewise, if the field contains a valid URL then the script executes as normal, which is the basic "Open URL" function.   Thanks for your help!!!

Link to comment
Share on other sites

Hi MattO,

 

I am Novice and started with FM about 4 months ago, i will be very happy(if not excited) if my following script can help you. Provided that each button have an individual script to work its function/purpose(e.g specific script for Facebook button, Instagram etc), try something close to the following:

 

If [ IsEmpty ( Table::Field _With_Url) ]

Show Custom Dialog [ Title: "Sorry!"; Message: "Instagram URL does not exist"; Default Button: “OK”, Commit: “Yes”; Button
2: “Cancel”, Commit: “No” ]

Else
Open URL [ Table::Field_With_Url ] [ No dialog ]
End If

  • Like 1
Link to comment
Share on other sites

On the side of the layout I have image icons (Twitter, Facebook, etc..) that are buttons with corresponding scripts to "Open URL" typed in the fields.

 

IMHO, you need only one script, with each button passing a different URL as the script parameter.

 

However, I wonder if it wouldn't make for a better user experience to have the buttons greyed out when the corresponding URL field is empty, and just beep when a greyed out button is clicked.

  • Like 1
Link to comment
Share on other sites

  • Newbies

Hi MattO,

 

I am Novice and started with FM about 4 months ago, i will be very happy(if not excited) if my following script can help you. Provided that each button have an individual script to work its function/purpose(e.g specific script for Facebook button, Instagram etc), try something close to the following:

 

If [ IsEmpty ( Table::Field _With_Url) ]

Show Custom Dialog [ Title: "Sorry!"; Message: "Instagram URL does not exist"; Default Button: “OK”, Commit: “Yes”; Button

2: “Cancel”, Commit: “No” ]

Else

Open URL [ Table::Field_With_Url ] [ No dialog ]

End If

My dear-You NAILED it! :)  Great job!  Thanks so much...Scripting terrifies me for some reason.  haha!  Happy Holidays, Miss A! :)

IMHO, you need only one script, with each button passing a different URL as the script parameter.

 

However, I wonder if it wouldn't make for a better user experience to have the buttons greyed out when the corresponding URL field is empty, and just beep when a greyed out button is clicked.

Hey thanks.   Sounds very eloquent but in my case, unnecessary-thanks so much for the time to reply, my friend! :)

Link to comment
Share on other sites

This topic is 3403 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.