1 2 3 Previous Next 40 Replies Latest reply on Sep 18, 2012 11:04 AM by zubir007

    disabling/enabling fields


      I've been trying to figure out how to enable/disable fields based on other fields and have no luck at all. What I would like to do is in default mode I would like to keep it disabled and then when I click on a radio button like yes/no the disabled field becomes active. Can someone please help me. Thank you.

        • 1. Re: disabling/enabling fields

          If you mean enter a field and enter data,  you could set up a set of identical layouts.  On the layouts where you should enter data have the field set as available in browse mode.  On the other layout have the field set so you can't enter it in browse mode.


          The script attached to the button can check user access and then change to the correct layout.


          This is one possible method.



          • 2. Re: disabling/enabling fields

            This is not what I am looking for.  What I am looking for is to be on the same layout and the same user. 


            Maybe I should make myself a little clearer.  Here is my situation


            I have a layout form with two fields


            Was Payment given? yes    no   (radio buttons)

            Reason for not giving payment:     (text edit box)


            so what I want is this:  


            I want the text box to be disabled initially until I push the button No.  When I hit the button No I want the text box to be enabled for me to enter stuff in it. If I push yes then I want to keep it disabled and no modification can take place.  How do I do this????? Please help me....if you can provide me with specific instructions I would be most appreciative (step by step with the script and script triggers)  .....Thank you.

            • 3. Re: disabling/enabling fields

              You can use an on Validate script trigger.  In the script check the value of the Radio button field.  If the Value is Yes,  Set the Value of the text field to "".  If the value is No committ the record.  This will save the Value.


              or you could OnObjectEnter script trigger.  In this version,  give the radio button an onject name.   In the script if the Value of the radio button is Yes use the Goto Object script step to go the Radio button field or some other object on the layout.  If the Value is No use the Halt script step to Halt the script.  This should leave the user in the field and let them enter the reason.



              • 4. Re: disabling/enabling fields

                Thank you Bruce for getting back to me. 


                For the first option that you provided does that allow me to still modify the reason text field if I click on yes if the user clicks in the reason text box? Because I feel like based on what you said the user still has the capability to edit the reason text field. What I want is, I want the user to not even be able to click in that text box to edit it.  If this is the case, can you please provide me with step by step directions on how to do this from beginning (i.e file-->manage script-->etc etc)


                I really appreciate all your help.  Thank you.

                • 5. Re: disabling/enabling fields



                  I'm giving 2 ways to do this.


                  i)Make a Tab object  which consist of 2 tabs[e.g Disable and Enable] and just named this object like its tab name.

                  ii)Make sure the default tab is Disabled and also this is a hidden tab.

                  iii) Write a script and attached with the Radio button set  and check if that radio button value is "No" then go to the Enable object othewise do nothing[e.g If "Yes" then halt the script].



                  i)Put that payment button on the exact layout and add a conditional formatting to this field in such a way that if Radio button vale is "No" then only it returns 1 and visible othewise it will invisible.

                  ii)In layout mode that field must be invisible/formatted with the background colour and make sure its browse mode is off.

                  iii)Added a script as button set up with that target field


                  If Radio Button value="No"

                  go to field (target field)


                  Thanks & Regards


                  • 6. Re: disabling/enabling fields

                    Or you could use an invisible portal like the sample I've attached.




                    • 7. Re: disabling/enabling fields



                      Thank you.  I like your second way but I'm not sure how to do this.  I am kind of new at this conditional formatting and scriptting thing would you be able to provide me with step by step directions on how to do this from beginning to end (i.e. click file -->manage script--> etc etc).  I would really appreciate it.  THank you.

                      • 8. Re: disabling/enabling fields




                        This is exactly what I am looking for can you give me specific directions on how to do this step by step because I've never done invisible portals.  I am waiting for your reply.  Thank you.






                        • 9. Re: disabling/enabling fields

                          Create a script to use as a script trigger by going to

                          Scripts -> Manage scripts -> New


                          Here is the script:


                          Allow User Abort [Off]

                          If [payment::radioField = "No"]

                               Halt Script


                               Go to object [Object Name: "payRadio"]

                          End If


                          Next in edit mode right click the reason for no payment field and select set script triggers. Check OnObjectEnter and select the script you just created. click Ok


                          Now click on your radio button and in the inspector pane under the position tab type payRadio in the Name field at the top of the window.



                          What is really going on here: This script runs when you enter the reason field and check the status of the radio button. If the radio button  is = to "No" then it stops and you can edit this field otherwise it sends the user back to the radio button.



                          • 10. Re: disabling/enabling fields

                            Hey Nick,


                            If you scroll up and see DC Hiler's file that is exactly what I am looking for however I don't know how to do that.  Do you know how to do it that way because that way is perfect.  Can you provide me with steps for that methodology.  I'd really appreciate it.  Thank you



                            • 11. Re: disabling/enabling fields

                              Though that method works here is the problem. When you switch between records and create new ones it tends to be very buggy. For example go to a record that has No selected then create a new record and select yes...oops now you can type in the reason field not good. I would recommend trying the script trigger method instead of the invisible portal method in that example. If you also want the field to disappear you can add conditional formatting. How you do the conditional formatting depends on how your layout is setup, but one option is below.


                              1) create a button and make it the same size as your reason field.

                              2) set the button action to "Do Nothing" ( Right click the button -> Button Setup -> Do Nothing - > Ok )

                              3) set the fill color in the inspector to nothing/transparent ( how you do this depends on FM version 11 vs 12 )

                              4) right click the button and select Conditional Formatting

                              • Click Add
                              • Click specify next to the Formula is menu item
                              • Enter this formula (note: use your table and fields names FYI this is your radio field): Table::Field = "Yes"
                              • Check the Fill Color box and select the color to match your background color.
                              • Click Ok



                              This method will give you the same results, but more reliable.



                              • 12. Re: disabling/enabling fields



                                Nick what are payradio and radiofield in your script are they fields that you just made up?

                                • 13. Re: disabling/enabling fields

                                  radioField is a name I made up for your Yes No radio button field. payRadio is a name I made up for the yes no radio button field object on the layout. What is important is that the name you use in the Go to Object script step is the same as the name you type in the Name field in the step below.


                                  Now click on your radio button and in the inspector pane under the position tab type payRadio in the Name field at the top of the window.



                                  • 14. Re: disabling/enabling fields



                                    I did what you said.  It doesn't work.  What did I do wrong here.  I am attaching the file for you to take a look.  Thanks for your help.  I appreciate it. 

                                    1 2 3 Previous Next