11 Replies Latest reply on Jun 27, 2016 2:16 PM by hampdentech

    Insert text into field from popup

    hampdentech

      I'm a newbie so I apologize if this seems basic or has been asked before.


      I have a text field in a form. I also have a separate (unrelated) table containing standard phrases. The table contains a primary key, a brief text field and then a long phrase.

       

      I'd like to give the user a button they can tap (UI is for iPad) and have it present them with a list of phrases. When they select a phrase I would like the full phrase text from that record inserted into the text field in the form at the current insertion point.

       

      The idea is to allow the quick entry of notes using predefined phrases so that the user can minimize their typing.

       

      I'm not sure where to begin on this. I suspect it could be done with a popup menu using a Value List and then executing a script trigger but I'm not exactly sure. Also, I'm not sure a popup menu is the most intuitive method. I'd prefer to have them tap the button and then have a new form appear where they can select the phrase.

       

      At any rate, if anyone can nudge me in the right direction I'd appreciate it.

       

      Thanks!

      Bob

        • 1. Re: Insert text into field from popup
          karina

          I added a file with a popup.

          You can use the add address button to see the popup.

           

          I would use a search field on top of the popup to filter the list.

          If this is something you want let me know if you need some help with the search field.

          • 3. Re: Insert text into field from popup
            hampdentech

            Great! Thanks for the help.

             

            I had actually given it some more thought and I figured I could use a Global field in a "resources" table to store the primary key for the selected phrase. Then, in the script, return to the initial form, set the view to the appropriate tab, and insert the text associated with the selected phrase into the text field.

             

            I can see what you're doing and that is similar.

             

            Thanks again!

            • 4. Re: Insert text into field from popup
              cortical

              add a  button to open a popover, rather than a separate window.

              Put a portal in the popover, with related phrases

              a phrase portal row button/script to capture the phrase to a $_variable, and

              - either INSERT CALCULATED RESULT the variable value into the target field; if you capture the insertion point before opening the popover

              - or as per the demo, first have the open popover script  insert a placeholder string (###),  then select and Substitute the phrase for the string

               

              Leaving the layout to go to a go to a phrase layout will have an implicit commit, losing the insertion point

              • 5. Re: Insert text into field from popup
                hampdentech

                Thanks for the reply. I like this solution as well. The only issue I might have is that there could be 100's of phrases to pick from so it might be preferable to allow the user to drill-down search on a keyword or pick from a category.

                • 6. Re: Insert text into field from popup
                  cortical

                  <<The only issue I might have is that there could be 100's of phrases to pick from so it might be preferable to allow the user to drill-down search on a keyword or pick from a category.>>

                   

                   

                  then either create a search function for the phrases, or create a  2 or 3 level hierarchy classification

                   

                  For a search; create a aec_phrase_keywords field in the Phrase table

                  aec_phrase_keywords  = Substitute ( phrase, " " ; < pilcrow> ) & <pilcrow> & phrase

                  <pilcrow> is the carriage return character

                  a REL for the search

                  and a  search global, script trigger on the search field to refresh the result on keystroke...

                   

                   

                  Classification hierarchy is a bit more involved

                  • 7. Re: Insert text into field from popup
                    hampdentech

                    Okay, putting this into action but I can't see where you named "ptl_phrase" that you reference in the "Go to Object" call in the script. In the inspector the popover button does not have a name.

                     

                    I'm sure I'm missing something but if you point me in the right direction I'd appreciate it.

                     

                    Thanks again!

                    • 8. Re: Insert text into field from popup
                      cortical

                      "ptl_phrase" is the object name of the portal in the popover

                      - Inspector, whatever the first tab is called theses days, Position, Name

                       

                      having the script go to object contained within the pov, forces the popover open

                      object naming btw  is a best practice. It also really helps when debugging, using fmXRaySpecs, using BaseElements for locating error objects...

                       

                       

                      The popover button  ( call it btn_pov for example) itself is not the target

                      try making it the target of a simple button; it will only become selected, but the pov itself will not open

                      the target is the portal, within the popover, being raised from the popover button:

                      btn_insert_phrase

                      btn_pov_phrase ( or pop_btn_phrase)

                      pov_phrase

                      ptl_phrase

                       

                      (we all have our own naming conventions lexicon)

                       

                      If you get to having a  global search field (fld_search) on the popover, then make that the go to object target. that way the cursor is entered into the search field automatically; one less user action

                       

                      The other aspect that there is a ordinary script button calling the popover opening, rather than the popover button being labelled with 'insert' and that being the user click point.

                       

                      This is not always necessary, but it does add flexibility:

                      - to place the popover somewhere other than the calling button

                      -  maybe hide the popover button altogether

                      - maybe have layout several buttons call the same popover containing several slide control panels, and conditionally going to a specific SCP on the POV

                      - or call a popover from a portal row button

                       

                       

                       

                       

                       

                       

                       

                       

                      • 9. Re: Insert text into field from popup
                        hampdentech

                        Okay, lots of good information here.

                         

                        Yes, "ptl" is your prefix for Portal. That makes sense and I was able to find that.

                         

                        It's working very well in my app now. I placed the launch button over the popover button so the user will not see the popover button and try to tap it. I also added a button the popover to allow the user to cancel out and then it also clears out the insertion point text.

                         

                        I haven't done anything with the search yet, but that shouldn't be too difficult.

                         

                        Thanks for all of your help. Very happy with the results so far!

                        • 10. Re: Insert text into field from popup
                          cortical

                          you can also add  hide object behaviour to the popover button:

                          Inspector, 4th (data) tab, behaviour, hide object when: 1

                          i.e just enter the number 1, which is always true

                           

                          That way the pov_btn is always readily visible in layout mode

                          • 11. Re: Insert text into field from popup
                            hampdentech

                            Thanks for the tip. Works great!