Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Maintaining selected text when switching tabs?

Featured Replies

Hello, all--

 

When switching tabs, any text that had been selected in the original tab is no longer selected in the second tab.

 

original tab:

post-63807-0-84118800-1379445239_thumb.p

subsequent tab:

post-63807-0-17667000-1379445282_thumb.p

An OnTabSwitch trigger, calling this simple script, didn't solve the problem; it seems like the conclusion of the script causes a jump back to tab1:

post-63807-0-55807000-1379445337_thumb.p

 

Any suggestions appreciated. Thanks very much!

 

 

Solved by Fitch

Go to solution
  • Solution

This happens whenever you have multiple instances of a field on a layout and you put the focus on the field, e.g. with Go to Field. In this case, setting the selection puts the focus on the field. I believe it is the object stacking order that determines which instance "wins."

 

To control this, give each instance of the field an object name, and after the tab switch, have it go to the object on that tab. Then, when you set the selection, leave the target field option blank, i.e. don't specify a field.

Set Variable( $selectedStart ; Get ( ActiveSelectionStart ) )
Set Variable( $selectedSize ; Get ( ActiveSelectionSize ) )
Go to Object( "tabField2" )
Set Selection( Start: $selectedStart ; End: $selectedStart + $selectedSize - 1 )

Try naming the field object itself. Something like:

 

Go to Object [field2]

Set Selection [start Position: 1; End Position: 21 ]

 

 

Dont set a field as a target

 

 

Edit: Looks like tom got you in the right direction... :-)  The selection start and size may have to be stored in a couple of global variables with an onObjectExit on the field though.

  • Author

Ah you're right, not specifying the field did the trick.  But now here's something weird that I wasn't expecting...

 

If you click the 'go to tab 2' button in my attached sample file, the text is selected as desired but it's EDITABLE!  The field in tab 2 is actually defined to disallow data entry in browse mode, but I am still able to add or delete text until I commit the record.  Does this have something to do with the object stacking order or some other layout behavior?  Is there any way around this, because I can't allow my users to edit text in the 2nd tab.

 

Thanks very much for your time!

fmf.fmp12.zip

Well if you have the text selected then it is editable. You can always go the old fashioned method and use a calculation field for your second tab. Then they cant edit it at all.

  • Author

Well if you have the text selected then it is editable. You can always go the old fashioned method and use a calculation field for your second tab. Then they cant edit it at all.

Yes that's another good idea, a calc field would be un-editable no matter what.  Many thanks to you both.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.