6 Replies Latest reply on Jan 21, 2013 6:17 PM by SoftailDeLuxeGirl

    Trouble with checkbox or radio? Having another blond moment!

    SoftailDeLuxeGirl

      Title

      Trouble with checkbox or radio? Having another blond moment!

      Post

           This "seems" like there would be a super simple solution, but I don't even know how to phrase the search right because I'm not exactly sure what department this belongs to: validation, calculation, custom dialog???

           Here's what I want to do:

           I have a Yes and No question... "Do you have a membership number?"

           If they choose "Yes", I would like a text input field to appear (make it required) so they can type in their membership number and it gets stored. I was reading about "custom dialog boxes" that can have text input fields, but I couldn't really find the right answer. 

           If they say "No", I would like "None" stored in the field so that I can sort them out at a later date, and send them info on the club.

           Is this possible?

        • 1. Re: Trouble with checkbox or radio? Having another blond moment!
          philmodjunk

               Since selecting both Yes and No does not make sense, I recommend using radio buttons to make that more clear to the user that they are expected to select one value, not both.

               A membership number field can be set up with an auto-enter calculation that enters "none" if the value of the radio button field is "No".

               An OnObjectModify script trigger can perform a script that uses show custom dialog to display a custom dialog with the membership number field as an input field if the value of the field is now "yes".

               Or

               You can use one of several visibility control tricks to make a field to the right of the radio button field visible and accessible for data input when the user clicks the "yes" radio button.

               What might be simpler is to set up a tab control with two tab panels labeled "yes" and "no". You can put the membership number field on the "yes" You can easily find all records that don't have a membership number without putting "none" in the field. Enter find mode, put "=" in the membership number field and perform a find and you get all records that do not have a membership number.

          • 2. Re: Trouble with checkbox or radio? Having another blond moment!
            SoftailDeLuxeGirl

                 OK, so radio buttons it is... but I need laymans terms on the rest... sorry but I warned you, I am blond!!!

                 I'm happy to search the forums for the "how-to" part, but I want to make sure that I'm searching for the best solution.  That said, I like your 2nd suggestion... just where do I find these visibility control tricks that make the text input field visible only if the user chooses yes?

            • 3. Re: Trouble with checkbox or radio? Having another blond moment!
              philmodjunk

                   I listed several different options. I won't describe them all in detail, it takes too much time. Which one do you prefer?

              • 4. Re: Trouble with checkbox or radio? Having another blond moment!
                SoftailDeLuxeGirl

                     This one:

                     "You can use one of several visibility control tricks to make a field to the right of the radio button field visible and accessible for data input when the user clicks the "yes" radio button."

                • 5. Re: Trouble with checkbox or radio? Having another blond moment!
                  philmodjunk

                       First, there's a demo file you can examine that demo's several visibility control tricks that can make layout text, buttons and/or fields disappear "on command": https://www.dropbox.com/s/8levaz6deiyzjr8/LayoutObjectVisibilityControlDemo.fp7

                       If you are using FileMaker 12, open this file from the File menu and you'll get a converted copy you can examine in FileMaker 12.

                       The method from that demo file that I'm going to describe here is the Portal method. It requires little or no scripting, just a self join relationship.

                       Let's call your table "DataEntry". We'll name the yes/no field "MembershipQ". Let's also assume that you have an auto-entered serial number field: __pkDataEntryID.

                       To DataEntry, add this calculation field:

                       constYes:
                       "Yes"

                       Select "text" as the return type for this field. (Name the field constYes and enter "yes" in quotes as its sole calculation term.)

                       Go to Manage | Database | Relationships and click the Table Occurrence "box" for DataEntry.

                       Click the Duplicate Button (two green plus signs) to produce a new occurrence of the same table: DataEntry 2. You have not duplicated a table. Instead you have created a new reference to your existing DataEntry table so you can link DataEntry to DataEntry 2 in a relationship.

                       DataEntry----DataEntry 2

                       DataEntry::__pkDataEntryID = DataEntry 2::__pkDataEntryID AND
                       DataEntry::constYes = DataEntry 2::MembershipQ

                       Now place a one row portal to DataEntry 2 on your layout next to the MembershipQ field. Put the membership Number field and any label text inside this portal. You can make the borders of this portal transparent or zero width to keep the portal invisible.

                       When the user clicks "yes" in the membershipQ field, you establish a valid relationship between the current record and itself and a related record appears in the portal--displaying the membership number field.

                       Note: You may need to use the OnObjectModify script trigger to do a one line script: Commit Records[] if you don't see the record appear in your one row portal until you click the layout background.

                  • 6. Re: Trouble with checkbox or radio? Having another blond moment!
                    SoftailDeLuxeGirl

                         Much love Phil...you saved me!