Forum Discussion

MackenziePhilli's avatar
MackenziePhilli
Qrew Trainee
5 years ago

IOL Techniques for Dialog box

Hello,

Trying to use IOL technique to create a dialog box that appears on a dashboard.

Is this technique still compatible with quickbase?

Is there any instruction or examples out there of code for the js code page to take in text and update a record?

Thanks



------------------------------
Mackenzie Phillips
------------------------------
  • I am not very familiar with JS but want a dialog box to popup when a user edits a field. Dialog box allows the user to type in value, close and reloads page. Typed in value updates the field in the record. PLEASE HELP

    The code for my button is:

    [iol] & "moduleDashboard.js" & [/iol]
    &"<a class='QBU_Button6 Vibrant Success' style='margin: 3px'" &
    " data-rid='" & [Record ID#] & "'" &
    ">Button 6</a>"


    Code for my page moduleDashboard.js

       (function(){   (function(){
      var dbid = "appID"; 
    var dbidDashboard = "TableID"; 
    var apptoken = "AppToken"; 
    $.ajaxSetup({data: {apptoken: apptoken}});

    //Button 6 Click Handler  $("a.QBU_Button6").on("click", function(event) {
        var rid = this.dataset.rid;   
        var markup = "<h1>Filter Project</h1>";   
    markup += "<div id='QBU_Expiry'></div>";
        var $mydialog = $("<div>").html(markup).dialog({     
    title: "Filter Project",     
    modal: true,     
    autoOpen: false,     
    width: 400,     
    resizable: false,     
    buttons: {       
    UPDATE: function() {  var projectnum = prompt("Enter a project number: ", "");         
    $.post(dbidDashboard, {           
    act: "API_EditRecord",           
    rid,           
    _fid_20: projectnum         
    }).then(function(xml) {           
    document.location.reload(true);               
    });         
    },         
    CANCEL: function() {           
    $(this).dialog("close");         
    }                 
    },       
    open: function(event, ui) {         
    $mydialog.html(markup);       
    },        close: function(event, ui) {         
    //do something       
    }      });     
    $mydialog.dialog("open");
        });
      });
    })();



    ------------------------------
    Mackenzie Phillips
    ------------------------------