9 Replies Latest reply on Oct 1, 2013 2:23 AM by AntonyCleall

    On selection from drop down - make a field active

    AntonyCleall

      Title

      On selection from drop down - make a field active

      Post

           I have several types of profession in a drop down, i want to be able to do the following

           When 1 of the professions is selected it makes a field active to be filled in.  The drop down contains the professions - Solicitors, Doctors, Nursing Homes, Care Homes and Celebrants.  When the word celebrant is selected I want to make another field active or able to have the type of service they offer entered in to the field, if any of the other professions are selected then the field is not active or won't accept any data

        • 1. Re: On selection from drop down - make a field active
          philmodjunk

               You can set a validation rule that rejects all input unless the specified other field = "celebrant". That allows data to be entered into this field when the first field is not Celebrant, but the system then rejects it and displays an error message.

               You could also put the field inside the row of a single row portal to a related table. (And this can be a self join, so this can actually be a field from the same record) Either the relationship or a portal filter can control whether or not a record is visible in the portal and thus the value of the first field controls whether or not you have a field present in the portal to edit.

          • 2. Re: On selection from drop down - make a field active
            AntonyCleall

                 Struggling with this one - using the portal option

                 When I have set it up as shown in the attached screen shots  (I have put a field at the bottom right of my file as a test - called type of service)

                 The first thing I have it lets me put information into the field whatever option is selected in type, however it only displays the field when the type Celebrant is selected, but is retaining the information.

                 It is also creating a new record every time I add text in this field, so I end up with blank records at the end of the file.

                 What have I done wrong / missed.

                  

                 Thanks

                  

            • 3. Re: On selection from drop down - make a field active
              philmodjunk

                   The field should not be available to enter data unless the user has selected "celebrant" in the type field.

                   I tried zooming in, but with that many images combined into one, I can't see enough detail to tell exactly how you have set this up. Is the field located inside a portal?

                   Your self join cannot match only by the type field. You need a primary key such as an auto-entered serial number field so that your self join relationship only matches the current record to itself.

                   (BTW, in a self join that correctly matches a record to itself, the "create" and "Delete" options in the relationship are meaningless)

                   You may find this demo file helpful: https://www.dropbox.com/s/8levaz6deiyzjr8/LayoutObjectVisibilityControlDemo.fp7
                   If you are using FileMaker 12, open this demo file from the File menu to get a copy converted to the .fmp12 file format.

              • 4. Re: On selection from drop down - make a field active
                AntonyCleall

                     I dont usually struggle on things like this, but this one is proving a difficulty

                     I have set the following in the relationship

                type of service = type of service

                and

                Record Number = Record Number (auto entered serial number)

                     Placed the type of service  field (from contacts list 2) in to the portal.  When exiting the edit layout, it disappears, I select from the dropdown the word celebrant, however the field does not appear - I presume I need to set up something in the portal setup under the filtering, but not sure what?

                     The sample file has some excellent features I can use on another project I am working on, but these all seem to be for checkboxes.

                      

                     Thanks in advance

                      

                      

                      

                • 5. Re: On selection from drop down - make a field active
                  philmodjunk

                       The principle used with the checkbox field is the same. The only difference is the format of the field.

                       Try this test:

                       Select a value from the drop down list field and then click a blank area of the layout. Do you see a field appear in the portal?

                       The layout click commits the record and this can be scripted to take place with the OnObjectModify script trigger.

                       Also, make sure that Type of Service is a field of type text when you check it in Manage | Database | Fields.

                  • 6. Re: On selection from drop down - make a field active
                    AntonyCleall

                         OK as I have said before this sort of thing does not usually cause me issues - but this time wow.

                         I have set up everything as I think it should be with the script, but cannot make the field in the portal appear with a script.  The nearest I get to is when Celebrant is selected the record wants to save.  But not show the type of service field in the portal

                          If [contact List::Type = "Celebrant"]

                         Go to field [contact list 2::Type of Service]

                         End if

                          

                         Sorry to be a pain, but if I cant sort this I will need to look at it another way.

                          

                          

                          

                          

                          

                    • 7. Re: On selection from drop down - make a field active
                      philmodjunk

                           "the record wants to save"

                           It would appear that you have disabled auto-save for your layout if that means that you get a message asking if you want to save the record.

                           Commit records should then have the "no dialog" option specified to keep this confirmation message from appearing, or re-enable auto save for the layout.

                      • 9. Re: On selection from drop down - make a field active
                        AntonyCleall

                             Fantastic Phil,

                              

                             Sorted now - I now realise where I was going wrong - thanks for your help