Forum Discussion

DanaHauser's avatar
DanaHauser
Qrew Cadet
6 years ago

Pulling a field value into a code page

I'm needing to have a page open that will show some static text and a records [Client Name] dynamically.  The text is always the same, but the client name needs to be from the record where the button is clicked.  

I've tried to come up with a solution using the IOL technique, which I understand how IOL works, but I'm not so hot with Java Script.  What I thought would work is Dan D's Packing Slip Pastie, but scaled down, but it just wasn't happening. I thought I had it all correct, but the button wouldn't do anything.  I've been researching this, but my lack of Java just gets in the way.

Any help would be greatly appreciated.

Thanks,

Dana
  • Is this page setup as a Quick Base code page? Or do is it like a document / text file that you're opening up? 

    If you're familiar with Code pages - you can just throw all your text into an HTML <body></body> - 
    since it will never change - and then using a little bit of jQuery and a URL parameter to throw your custom name in there. 

    Your button would look something like:

    https://yourrealm.quickbase.com/db/mainappdbid?a=dbpage&pageid=20&customer=Customer Name

    You would swap your inputs for your actual realm and the actual id of the page you create - and then Customer Name would be dynamic based on your formula-url in a record

    Then your code page might be something like: 


    //START OF CODE PAGE
    <body>
    <div id="customer"></div>
    <div id="staticText">Your actual static text would go in here</div>


    //The below link brings in jQuery for you
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>;
    <script>
    //This will take the input you put in your URL for 'customer' from above using jQuery
    $('#customer').text(window.location.search.split('customer=')[1]);

    </script>
    </body>
    //END OF CODE PAGE

    Chayce Duncan | Technical Lead
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base
    • DanaHauser's avatar
      DanaHauser
      Qrew Cadet
      Thank you so much for the reply Chayce.  

      It's a QB code page that I will link to.  It just needs to bring over the Client Name, and have some basic text.  I'll give your suggestion a try and let you know how it goes.

      Thanks again for your help.

      Dana
    • DanaHauser's avatar
      DanaHauser
      Qrew Cadet
      Chayce, that worked great, it was exactly what I needed.  Now I can format the HTML to look like I need it to.  

      One question.  The space between the first and last name is showing the space as in Dana%20Hauser.  What's the best way to encode that space correctly.  Would I need to use 2 fields and bring the first and last name over separately?  Right now, I'm using a field that has the first and last name combined from a text formula field.

      Thanks, 

      Dana
    • ChayceDuncan2's avatar
      ChayceDuncan2
      Qrew Cadet
      You can just toss a simple .replace to swap out the encoding - %20

      In the same jQuery line - add .replace(/%20/g,' ') to replace %20 with a space to put it how you expect. 

      $('#customer').text(window.location.search.split('customer=')[1].replace(/%20/g,' '));

      Chayce Duncan | Technical Lead
      (720) 739-1406 | chayceduncan@quandarycg.com
      Quandary Knowledge Base