1 2 Previous Next 18 Replies Latest reply on Oct 28, 2010 3:56 PM by philmodjunk

    Button in portal does not work properly

    rhille

      Title

      Button in portal does not work properly

      Post

      Hello

      I am creating a DB and there is a layout that has a portal on it and that is linked to another table. The list shows the current customers. When I show this layout, no records are highlighted and all that that works fine.

      Now what I am trying to achieve is simply this: when no line is selected, I want a button at the button of the page to read NEW and when a line is selected, I want the button to read MODIFY. Now, from what I could gather in the forum, I guess the best way to do that would be to use a transparent TAB PANEL with two pages, each one with the appropriate button. Each tab would obviously be named accordingly. Since, by default, no lines would be selected when I get on the page, I have set that TAB PANEL as showing the NEW button by default, and again all that is ok.

      The problem I am having is that when I click on one field that is on the portal, it does not run whatever script I selected. I even tried a simple message to troubleshoot and it did not work either. But if I copy the field elsewhere on the layout, it does work properly.

      Any ideas as to what I am doing wrong?

      Thanks

      Rick

      SS_PhilModJunk.png

        • 1. Re: Button in portal does not work properly
          philmodjunk

          Please post your script that doesn't work.

          Here's one possible issue:
          Some script steps like go to portal row work on the "active" portal. Since you have two portals in different tabs, it may not be interacting with the correct portal. Sometimes you have to use the inspector to give the portals object names, then use Go To Object just before the Go To Portal Row step to make sure you are interacting with the correct portal.

          Another way to get a button where its label text and function changes is to place a blank button on your layout and then group it with a calculation field, global field or variable. You then have a button that can display different text in different situations and it's script can check the contents of this field or variable to determine what steps to perform.

          • 2. Re: Button in portal does not work properly
            rhille

            Hello PhilModJunk

            I'm almost there (I think...). The only line in the script is Go to object "NameSelected" and it now works. Unfortunately, before I added that script, the edit field used to go red when clicked on, based on a conditional formating. Now that I have added a go to script, the conditional formatting does not work anymore... Weird!

            Rick

            • 3. Re: Button in portal does not work properly
              philmodjunk

              Perhaps the conditional formatting only specied on the copy of the formatted object that is in one tab and this formatting is not set up for the same item in the second tab?

              • 4. Re: Button in portal does not work properly
                rhille

                Sorry PhilModJunk

                I think I might be a bit tired here or my English skills are lacking (since it is not my first language) but I do not understand what you are saying. Obviously, it is not always easy for people on forums to help fellow programmer since it is sometimes difficult to understand or see exactly what we are trying to achieve.

                That being said, and please do not feel obligated in any way but what I would suggect is this: Again, if you do not mind, I could give you a temporary access to my FTP site so you could download the test file I am working on. That way, you will understand exactly what I am trying to do. Just PM me if you agree (and no I won't ask you to finish the job for me...). Otherwise, we will have to do our best with the forum.

                Thanks again

                Richard

                • 5. Re: Button in portal does not work properly
                  philmodjunk

                  How about a simpler approach, what is the conditional format expression that turns the item red? And what item is this?

                  I was speculating that you have two copies of a button, each copy inside a different tab of your tab control. If one button has conditional formatting to turn the text or fill color red and the other does not, you might get the result you describe when the script brings the tab with the unformatted button to the front. Obviously, I am making a lot of guesses that could be way wrong here.

                  I'm not saying no to the FTP route, just suggesting we take one more run at this way first.

                  • 6. Re: Button in portal does not work properly
                    rhille

                    Sure thing.

                    I have included a Screen Shot. I hope it works... I will try to explain it in a more detailled way.

                    On my layout, I have a portal in the center. In that portal, I have fields like name, address and so on. Whenclick on in the Browse mode, those fields turn red to show they are seleccted. Now, at the bottom of the layout, I have a button that is outside of the portal and it is the one I want to put inside a TAB PANEL. When I click on one of the field inside the portal, I would like the TAB to change and the line to be highlighted. Now, I am only able to do one at a time. Even if I put a conditional formatting and a button script...

                    I hope my explanations are clear and that you will be able to see the picture.

                    Thanks a million

                    RIck

                    P.S. It looks like the picture did not work...

                    • 7. Re: Button in portal does not work properly
                      philmodjunk

                      Easiest way to upload a picture, is to edit your very first post and use the control there to upload your file. With subsequent posts, you have to upload the file to a file sharing site and then post a link to it here.

                      To highlight a portal row, you can use Go To Portal Row with the select option enabled.

                      I think you are losing the selected portal row because your script uses go to object to change the tab control and this releases your portal row.

                      Your portal row can use a get function to save the current portal row number in a variable, manipulate the tab control, then use go to portal row and your variable to re-select the portal row.

                      • 8. Re: Button in portal does not work properly
                        rhille

                        I have uploaded the picture. Now I will try to implement what you explained in the previous post.

                        Thanks again

                        Rick

                        • 9. Re: Button in portal does not work properly
                          rhille

                          Now we are getting somewhere, but we are not there quite yet!

                          Here is the script I have put in the button option of the field:

                          Set Variable ($PortalRow; Value: Get (ActivePortalRowNumber))
                          Go To Object (Object Name: "Name Selected")
                          Go to Portal Row (Select; No dialog; $PortalRow)

                          The script seems clear enough but it does not work properly: The main portal is in a TAB PANEL to enable me to change the portal sort based on the header the user clicks on. If I use the previous script, FM Pro sometimes changes the TAB of the main portal but sometimes it does change the button portal...

                          Rick

                          • 10. Re: Button in portal does not work properly
                            philmodjunk

                            So you have more than one portal on your layout, each in a different tab?

                            If you have more than one portal, you'll need to give an object name to each portal and put a go to object step that "goes to" that portal just before the Go To Portal Row step.

                            If you've set up your script so that the same script is used on more than one tab with more than one portal, you'll need to pass the object name of the portal as a script parameter in the script trigger setup and use:

                            Go To Object ( Get ( ScriptParameter ) )

                            • 11. Re: Button in portal does not work properly
                              rhille

                              Ha! It works now except for the line that should be in red and is in gray instead which looks like the basic selection for a portal. I guess it is good enough for now but I will continue to try and find a way to highlight the line in red.

                              A big thank you for your help

                              Rick

                              • 12. Re: Button in portal does not work properly
                                philmodjunk

                                I'd compare the conditional formatting where you are getting a red fill color with where you do not to see if I can spot what's different or why it works in one and not the other.

                                • 13. Re: Button in portal does not work properly
                                  rhille

                                  Actually, if I take out the script that changes the TAB with the buttons it works... but I will keep searching.

                                  Thanks again

                                  Rick

                                  • 14. Re: Button in portal does not work properly
                                    philmodjunk

                                    What is the expression used in your conditional format?

                                    1 2 Previous Next