Discussions

 View Only
  • 1.  Redirecting After Hidden ""RID"" Input Changes on New Records

    Posted 02-06-2018 20:22
    So the task I have been trying to accomplish entails that after a new record is added, we need to use _API_CloneMasterDetail _to copy a template record's report link. The main issue I ran into with this was obtaining the new record's _Record ID#_ before the form redirected to my _RedirectURL_.

    I found though that there is a _<input type="hidden" name="rid" value"" /> _where the value is a long integer (no idea what it represents), when adding a new record and is the _Record ID#_ when messing with an existing record. For new records, the hidden input changes _right_ before the redirect takes place. So, I wired up an event handler to track when the hidden input changes to the new _Record ID#_ and then I _window.location.replace() _to my code page with the new _Record ID# _as a URL Parameter.

    While this allows me to run the _API_CopyMasterDetail_ request as desired, and the new record is created with the new copied report link, I wanted to check if anyone knew if redirecting this way at this stage after the hidden input changes would break/not run an important Quick Base task? Or, is redirecting manually at this stage pretty much the same as letting the _RedirectURL_ do its thing?

    The reason I can't use _RedirectURL _at this point, is updating the _RedirectURL_after_ the hidden input is updated doesn't seem to get respected when Quick Base decides to redirect - it uses the old value before the hidden input was updated.


  • 2.  RE: Redirecting After Hidden ""RID"" Input Changes on New Records

    Posted 02-06-2018 20:29
    Partial answer. That rid value you see is a sentinel value of 32 1's (binary)

    4294967295 = 0b11111111111111111111111111111111

    There might be some AJAX going on just before the new record form submits which supplies the newly created [Record ID#] value.

    I don't have time to look at other aspects your post raises at this time.


  • 3.  RE: Redirecting After Hidden ""RID"" Input Changes on New Records

    Posted 02-06-2018 20:38
    So I do already have the newly created [Record ID#] _at the point I do the _window.location.replace()_. Right before Quick Base redirects you, _<input type="hidden" name="rid" /> _updates it's value to the new entries _[Record ID#]._

    Really my main question is, at this point, since the record has obviously been created at this point - because I have the _[Record ID#] _- would I be skipping a Quick Base process, other than its native redirect, by doing a manual _window.location.replace()_?

    No worries if you don't have the time, I really appreciate your help today. I might try to by pass this issue by just making my own AJAX call to my code page and allowing Quick Base to do it's native redirect. 


  • 4.  RE: Redirecting After Hidden ""RID"" Input Changes on New Records

    Posted 02-06-2018 20:44
    If you are that deep into scripting I don't see any purpose in relying on QuickBase's redirect mechanism. Just control the whole process with script and you don't have to play guessing games or perform lots of experiments figuring out what these hidden parameters do on the back end.

    There are a lot of remnants of techniques that might have been cutting edge in 2000 that are still in the code base. I can't image who would use a sentinel value today for just about anything. Redirect parameters? XML not JSON? The list is long.

    Luckily we have excellent developers and product managers who are modernizing the product with help from the future.