RedirectURL: Editing form A to open a related form B and then return to edit form A

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

When a specific status in a drop down field on form A is selected, I need a related form B to open so I can update the fields of form B based on the  selection in the drop down on form A. Is this possible? It would be preferable that form B open in another window, however it would also be acceptable if I was taken to form B and then redirected back to form A after completing the form B.

Photo of Patrick

Patrick

  • 90 Points 75 badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,780 Points 50k badge 2x thumb
Are these forms off the same table or a different table?
Photo of Patrick

Patrick

  • 90 Points 75 badge 2x thumb
Each form is on a different table. There is a relationship between the tables.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,780 Points 50k badge 2x thumb
There can be a link to form B, but i do not know if a native way to cause form B to open upon selecting a drop down choice.
Photo of Patrick

Patrick

  • 90 Points 75 badge 2x thumb
Basically, I am trying to get a form to open that allows me to schedule workers for a job. The job becomes active based on the selection of a "Booked" status in a drop down menu. Table A is the jobs and Table B is the crews/trucks.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,780 Points 50k badge 2x thumb
Typically you would save the Job and then click a button to add a scheduled Worker.  The Scheduled Workers would be an embedded report on the Job record.  Scheduled Workers would be the Many to Many "join" table between the Table of Workers and the Table  of Jobs.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,074 Points 20k badge 2x thumb
You need to use the image onload technique to inject some JavaScript into each form.

For Form A you need to inject this code:

$("#RedirectURL").val(<url for Form B>);
$("input[name=rl]").val("");

For Form B you need to inject this code:

$("#RedirectURL").val(<url for Form A>);
$("input[name=rl]").val("");

Note that there is probably other logic that needs to be implemented such as your "drop down field" logic, cancel and error handling etc.
Photo of Kp

Kp

  • 14 Points
Hi Dan, I know the RedirectURL, but what is the iput[name=rl]? what does it do?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,074 Points 20k badge 2x thumb
It is a hidden field used on QuickBase forms that directs what report to return to after viewing or editing an individual  record. I don't know the internals but I would assume it is used to control caching of the report page. In other words, I think QuickBase uses the rl parameter to efficiently return to the report after viewing or editing a record without re-querying the report if the report has not changed. By setting rl to an empty string the RedirectURL will allow you to specify what page to redirect to.

I should mention that this is a very crude process of control what to do after viewing or editing a form. Modern applications would use some type of router to control what happens after various page interactions.
Photo of Kp

Kp

  • 14 Points
In my code, I only changed RedirectURL, and it works. I thought this is a router related. Surprisingly it is not.  Thank you for your reply.