Discussions

 View Only
  • 1.  How to load custom modules or code pages

    Posted 07-01-2017 16:01
    I am trying to step up my coding knowledge and experience within Quick Base. I know there are ways to create code pages and pull in custom scripts. My struggle is basically this, I am not a code writer. I have implemented a couple of items but want to take it to the next level. I understand the code pages, but am not quote sure how to make the call to the module and what fields (text formula fields) to add to the form to make that call.

    Some detail would be greatly appreciated....once someone shows me how to turn on the light switch I will get it!


  • 2.  RE: How to load custom modules or code pages

    Posted 07-04-2017 14:15
    i think you can use the famous IOL Technique

    Just create  a formula text field and make  the "Allow html tags" as checked

    Paste the below code on the formula 
    "<img qbu=\"module\" src=\"/i/clear2x2.gif\" " &  "onload=\"javascript:if(typeof QBU=='undefined'){QBU={};$.getScript('" &  URLRoot() &"db/" &Dbid() &"?a=dbpage&pagename=module.js&rand='+Math.random())}\">"    Create a page in Home-Settings-Pages-New Page and have the below code     $(document).ready(function(){  alert("Page is Loaded !!")  })    Save the page as module.js

    Write whatever code you wish to have in the module.js. 

    You can rename the page , but the same page name should be called on the formula too.

    I hope this will solve your issue!!


  • 3.  RE: How to load custom modules or code pages

    Posted 07-04-2017 16:23
    Is this custom code limited to being used only on a form where that formula text field is loaded? What if I wanted to use some additional, external functions in formula field formulas? Is this possible? How does the IOL technique with the formula text field work for that situation?


  • 4.  RE: How to load custom modules or code pages

    Posted 07-05-2017 12:57
    There is no mechanism for JavaScript to exchange values with the formula language. However, you can use JavaScript to place content in the same position a field would occupy giving the appearance that a server side formula calculate the value. Does that answer you question?


  • 5.  RE: How to load custom modules or code pages

    Posted 07-05-2017 14:51
    So is this IOL mechanism limited to fields displayed on forms, or can I include it in a formula field or have it work for me in a grid edit situation?


  • 6.  RE: How to load custom modules or code pages

    Posted 07-05-2017 14:54
    IOL will work on {new, edit, view, report and grid edit} pages. Basically it works on any page where you can place a raw field - you can't use IOL on chart pages because you can't put a raw field on those types of pages.

    If you need script injected on other pages you can use BOL (Branding OnLoad) or SW (Service Workers).


  • 7.  RE: How to load custom modules or code pages

    Posted 07-05-2017 14:56
    Thanks for the clarification!