Discussions

 View Only
  • 1.  How can I edit a text-field from the GeditSubmit() function?

    Posted 11-06-2017 21:38
    Using the IOL technique, I am able to parse all of the edits a user made while in grid edit.

    function GeditSubmit(dbid) {
      if (!gGED.HasDataChanged() && !gAndDone) {
        QBalert("<div class=redhead>Nothing to save.</div>You haven't made any changes.");
        return
      }
      if (!GE_validate(gGED)) {
        return
      }
      ClearErrors();
      HidePopupDiv();
      QBbusy("Saving . . .");
      var jax = new jaxreq(dbid + "?a=QBI_GridEditSubmit");
      GE_AddGeInfoToJax(gGED, jax);
      jax.DoAsyncCmd(GESubmitCallback);
      var params = JSON.stringify(jax.params);
      [parse the xml string and get the data I want]
      [add that data to the desired field?]
      [save?]


    I make a string representing a record of those changes, which I would like to append to the current content of an existing text-field. How can I select that field, append the new text, and save those changes?


  • 2.  RE: How can I edit a text-field from the GeditSubmit() function?

    Posted 11-06-2017 21:47
    Although it is possible I would not really encourage you to use IOL with Grid Edit

    Beyond that advice, I don't understand what any of this means:

    "I would like to append to the current content of an existing text-field. How can I select that field, append the new text, and save those changes?"

    Which Field is in context? Which Record is in context? What are you concatenating (this string you parsed from the XML representing changes)?


  • 3.  RE: How can I edit a text-field from the GeditSubmit() function?

    Posted 11-06-2017 22:13
    For the app in question, I have 350+ fields, so the logging of each field within itself is impractical to look at.

    My 'Logs' field (let's call it fid_#_351) is intended to be a running log of all changes made to the row it is in. Ideally it should look something like this.

    The example related to the above link works perfectly if an edit is made within the "edit record" page, but not within grid edit. Using the example found here, I was able to create the string I want to add to the log every time an edit is made, but I can't figure out how to actually update the log.

    I have a text-field with an already existing log. I would like to simply concatenate a string I have made with the existing log, and save that change.


  • 4.  RE: How can I edit a text-field from the GeditSubmit() function?

    Posted 11-07-2017 00:21
    I would think about using a Service Worker to log relevant network requests from grid edit. At a meeting now but I could elaborate tomorrow.


  • 5.  RE: How can I edit a text-field from the GeditSubmit() function?

    Posted 11-07-2017 18:49
    This is a messy problem only because the grid edit code QuickBase uses is messy. I would discourage you from doing this because it is messy but on the other hand it sounds like you have an unmet requirement so you may need to pursue a script solution nevertheless.

    You basically have two options to intercept QuickBase's saving of the modified Grid Edit interface and create you custom logging feature (BTW I don' really understand the format you are describing).

    Serrvice Worker

    Create a Service Worker that will intercept network requests for ?a=QBI_GridEditSubmit and in addition to responding with the normal response, decode the XML response payload and perform a AJAX call to log changed values. The XML response has a tag <gridData2000> which encodes the [Record ID#]s and fields in a proprietary format that uses a five character delimiter (~~!~^). Here are a couple of sample XML responses:

    <qdbapi>
    <geRidListStr2000>1~~!~^-10~~!~^-11~~!~^-12~~!~^-13~~!~^-14~~!~^-15</geRidListStr2000>
    <geDFID2000>0</geDFID2000>
    <geDBID2000>bm8kqf65a</geDBID2000>
    <geOldRidListID2000>7208</geOldRidListID2000>
    <geDoneURLID2000>7</geDoneURLID2000>
    <gridData2000>
    n~~!~^-10~~!~^
    t~~!~^-10~~!~^6~~!~^~~!~^4
    t~~!~^-10~~!~^7~~!~^~~!~^5
    t~~!~^-10~~!~^8~~!~^~~!~^6
    n~~!~^-11~~!~^
    t~~!~^-11~~!~^6~~!~^~~!~^7
    t~~!~^-11~~!~^7~~!~^~~!~^8
    t~~!~^-11~~!~^8~~!~^~~!~^9
    </gridData2000>
    </qdbapi>

    <qdbapi>
    <geRidListStr2000>1~~!~^2~~!~^3~~!~^-10~~!~^-11~~!~^-12~~!~^-13</geRidListStr2000>
    <geDFID2000>0</geDFID2000>
    <geDBID2000>bm8kqf65a</geDBID2000>
    <geOldRidListID2000>7209</geOldRidListID2000>
    <geDoneURLID2000>7</geDoneURLID2000>
    <gridData2000>
    t~~!~^1~~!~^6~~!~^1~~!~^2
    t~~!~^1~~!~^7~~!~^2~~!~^4
    t~~!~^1~~!~^8~~!~^3~~!~^6
    </gridData2000>
    </qdbapi>

    Modify QuickBase Code

    QuickBase's Grid Edit Code is currently located hereL:

    https://assets.quickbasecdn.net/res/8abb665-19/js/gridEdit.js

    You can beautify the code and start reading it (it is a lot of fun so server drinks, make popcorn and turn it into a family event). The function GE_BuildRetval() has all the logic that builds the return value representing all the new and updated fields from the grid edit session. You can redefine this function using IOL and make it do what you want in addition to what QuickBase expects it to do. So grab the fields you need to create a log entry and make an independent AJAX call to log the changes in the format you desire.

    It is totally doable but like I said there are a lot of messy details.


  • 6.  RE: How can I edit a text-field from the GeditSubmit() function?

    Posted 11-10-2017 18:07
    Wow, you weren't kidding about it being messy. Got it to work by parsing the jax.params in GeditSubmit, adding my own edits and then sending it along to jax.DoAsyncCmd(GESubmitCallback);


  • 7.  RE: How can I edit a text-field from the GeditSubmit() function?

    Posted 11-10-2017 19:02
    I was being charitable when I described it as messy.

    But it is good to know that someone understood my rough description of how you had to dip into their code and patch things up. Sometimes I think people don't understand what I am talking about but it is validating that you got it to work for your unique needs.