Use the Image Onload Technique to redirect to a specific report - or some other method.

  • 1
  • 1
  • Question
  • Updated 1 year ago
  • Answered
I am trying to accomplish something with either the Image Onload Technique - or via my Formula URL, using an icon as a button.

I have a parent table where the user clicks a button to add a "detail" on the child record.

Once that window opens, they will fill out specific information, and then of course save the record.

What I WANT to happen, is for them to click on the Save Button/Icon, and it saves the record and then puts them back on the original parent record they came from - OR a specific report could work also.

An alternative could be:  They click on the save button, it saves and then closes the window they are on.  

What I have now - I have a button that they can click to save and it keeps them on the same record.  I also have working the Image Onload Technique that will save the record and then redirect to the homepage of the app.

I need to either redirect to the homepage of the app, or have it close the current window.  Can anyone help me with that one last step??

Here is my IOL code:
$("#RedirectURL").val(gReqAppDBID);
$("input[name=rl]").val("");

Here is my button code:
var text URL = "javascript:void(DoSaveAdd())";
var text URLtwo = URLRoot() & "db/" & [_DBID_APPOINTMENTS] & "?a=dr&rid=" & ToText([Related Appointment]);
var Text Image = "<a id='saveButton' class='Vibrant Success' onclick='DoSaveAdd()' href='#'>Submit</a>";

"<b href =" & $URL & URLEncode($URLtwo) &">" & $Image & "</b>"

Thanks in advance for any help
Photo of Stephanie

Stephanie

  • 10 Points

Posted 4 years ago

  • 1
  • 1
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
Is there any particular reason you're using this method over the standard "Add Record" buttons created by QuickBase?
Photo of Stephanie

Stephanie

  • 10 Points
I'm sorry - was that an answer to my question?
Photo of Stephanie

Stephanie

  • 10 Points
I have answered this with some amazing help from Dan Diebolt and his techniques using javascript.  

I want to say this in earnest to anyone who may be in a similar situation as I am...  our Company has grown rapidly and we are working to improve and expand our Quickbase along with it.  We have requirements and ideas outside of what the native Quickbase function allows.

I am learning and now know that there ARE ways to do just about anything you want or need to do in Quickbase.

**It will be worth your time to explore and learn what Dan is teaching with his Image Onload technique and other methods of employing javascript within your QB pages.  Instead of chasing these patched together formulas that are time consuming and difficult to figure out, you can have a quick, efficient answer.

I went from the convoluted attempt you see above to now having my solution and it is literally accomplished on 2 lines of javascript and has no more than about 20 characters.. I also have a plethora of other possibilities I can now explore.

THANK YOU, Dan!!
Photo of Carlos

Carlos

  • 836 Points 500 badge 2x thumb
Stephanie, could you comment on how you went about solving this? I actually have the exact same question as you did 3 years ago.
thanks!