• Resolved viewup

    (@viewup)


    Hello, i’ve notice that the plugin now have an tabs system, and it’s great.

    My problem is, i need to create an link to an certain unfilled field (to remember the user to insert it). The tabs system uses the anchor on url to determine the active tab. This way, when i open an anchor that isn’t one of the tabs, it hides all the tabs, showing nothing.

    Example url: mysite.com/wp-admin/options-general.php?page=swpsmtp_settings#swpsmtp_smtp_autentication

    Also, can you add HTML IDs for each input of the plugin form? This will help a lot identify them.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @viewup.

    I will think of something to make it work like you want. It would be a bit different than you might think though. Anchors will stay for tabs navigation, but perhaps additional parameter could be added to the url with the ID of the element you want the focus on. Something like

    example.com/wp-admin/options-general.php?page=swpsmtp_settings&swpsmtp_id=swpsmtp_from_name#smtp

    Thread Starter viewup

    (@viewup)

    One thing that will be easy and solve the problem is this:

    • if the anchor is one of the tabs: show the tab (currently doing this)
    • if there is no anchor, add the first tab anchor and show it (currently doing this)
    • If the anchor isn’t any of the tabs, show the first tab (BINGO)

    An more sophisticated algorithm is this:

    1. check the anchor element (jquery get by id)
    2. get the closest parent that is an Tab (or the own element if is an tab)
    3. activate this tab

    Anything that i can help, tell me ??

    • This reply was modified 7 years, 2 months ago by viewup.
    • This reply was modified 7 years, 2 months ago by viewup.
    • This reply was modified 7 years, 2 months ago by viewup.
    • This reply was modified 7 years, 2 months ago by viewup.

    Thanks for detailed explanation. I like your method, the only thing though that you wouldn’t be able to focus on inputs that are not one the first tab.

    But if you’re ok with that, I will implement it per your guidelines.

    This is done, but a bit different ?? Now you can specify both tab and input ID you want to focus on.

    For example, if you want to focus on SMTP Username input, your link should look like this:

    mysite.com/wp-admin/options-general.php?page=swpsmtp_settings#smtp&swpsmtp_smtp_username

    As you can see, you can put input ID after &.

    If you want to focus on “Message” textarea on Test Email tab, you can use following:

    mysite.com/wp-admin/options-general.php?page=swpsmtp_settings#testemail&swpsmtp_message

    Version 1.3.4 with these changes is going to be released shortly.

    Thread Starter viewup

    (@viewup)

    This is great! The second approach would just stick with simple IDs, but this is much more sophisticated. Do you trigger JS focus (or scroll) on the field argument?

    Do you trigger JS focus (or scroll) on the field argument?

    Yes, sir. Both ?? Scroll first, focus after.

    Thread Starter viewup

    (@viewup)

    Great! Thank you very much! My users will like it.

    Since this looks resolved, I’m marking this thread accordingly.

    If there are any issues related to this, please post them here.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Cannot link with the new Tabs’ is closed to new replies.