Forum Discussion

MichaelMichael6's avatar
MichaelMichael6
Qrew Trainee
9 years ago

How to make a button return to the same place on the page.

I'm curious if a command can be added to a button to have the rdr go back to the same place on the page when you clicked the button.

Example... I have a button that adds a child record, but the button is basically in the middle of the form.  When you click the button, it successfully adds the record and comes right back to the parent, but you always land at the top of the page and not back where the button is (for more clarity, it's a "+" and a "-" button to add count to inventory, so I want to click the plus button and just return right back to where the button is on the page so I can click it again).

I'm not sure if this is Javascript, or part of a QB formula... or just not possible.

Thanks for the help!

  • Courtesy of a tip from the infamous Dan Diebolt, it turns out it's stupid simple.

    Make an anchor tag as a text formula field with HTML enabled and put it near where you want to position to after the button does its thing

    "<a name=PTdemo></a>"

    Then just suffix your last rdr with # and the tag name. The tag name is case sensitive and while I have not tested, I avoid any spaces or special characters.

    You may have to play a bit in the placement of the anchor tag. When you get it placed right, then just edit the form properties to hide the anchor tag field name so the field will be invisible

    Here is an example of the last part of a URL formula button. It will display the record and jump to the PTdemo anchor tag.

    h t t p s://xxxxxxx.quickbase.com/db/xxxxxxxqb?a=dr&rid=17#PTdemo
  • I am doing this but for some reason, it goes to the anchor, then it jumps back up to the top of the page. Any idea why? Formula - URL:

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=xxxxxxxxxxxxxxxxxxx&rid=" & URLEncode ([Record ID#])&"&_fid_88=" & URLEncode ([Location - Address: Street 1])&
    "&_fid_89=" & URLEncode ([Location - Address: Street 2])&
    "&_fid_90=" & URLEncode ([Location - Address: City])&
    "&_fid_91=" & URLEncode ([Location - Address: State/Region])&
    "&_fid_92=" & URLEncode ([Location - Address: Postal Code])&
    "&_fid_93=" & URLEncode ([Location - Address: Country])&
    "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#] & "#Anchor2")
  •  I have seen that same behaviour too.  I think that to get it to position to an anchor you ned to be in View mode after the rdr, so "a=dr" instead of "a=er".
  • Thanks for your response. It must be something browser related. I have set the same button up on another table and that one works fine in chrome but this one does not. The current button and anchor setup works in IE but not Chrome. So, anchors do seem to work in "a=er".
  • OK, thx.  I use Chrome  for all my development work and did not test in other browsers. 
    • JoseMuñoz's avatar
      JoseMuñoz
      Qrew Member
      I couldn't make it work in edit mode. Does anyone know how to resolve this?

      ------------------------------
      Jose Muñoz
      ------------------------------