how to create javascript pages

  • 0
  • 1
  • Question
  • Updated 6 months ago
  • Answered
Photo of Intuit QuickBase

Intuit QuickBase

  • 82 Points 75 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Gaurav Sharma

Gaurav Sharma

  • 5,756 Points 5k badge 2x thumb
Hi there,

You can go to the App settings then, click on the new button above the Pages link and select the code page option.


Give the name <YourPageName>.js



Please let me know if you have further questions.

Thanks,
Gaurav
Photo of Robert

Robert

  • 214 Points 100 badge 2x thumb
Gaurav,

I'm having trouble referencing <YourPageName>.js in my HTML code page.

If the pageid of <YourPageName>.js is 48, is this syntax correct?

<link href="https://mydomain.quickbase.com/db/mydbid?a=dbpage&pageID=48">;
Photo of Gaurav Sharma

Gaurav Sharma

  • 5,756 Points 5k badge 2x thumb
Hi Robert,

Just to let you know that we use link tag to reference the CSS files and for javascript, we use script tag.

Here are the examples.

For CSS:
<link rel="stylesheet" href="https://yourdomain.quickbase.com/db/bnnp8ryeg?a=dbpage&pageID=70">
For JavaScript:
<script src="https://yourdomain.quickbase.com/db/bnnp8ryeg?a=dbpage&pageID=71"></script>
You can actually use the page name as well.

https://yourdomain.quickbase.com/db/bnnp8ryeg?a=dbpage&pageName=main.css
https://yourdomain.quickbase.com/db/bnnp8ryeg?a=dbpage&pageName=modal.js
I would suggest you to always use ID because if someone changes the name later then, no need to change the name in your code as you have referenced the ID not name. :)

Please let me know if need any further information.

Thanks,
Gaurav 
Photo of Robert

Robert

  • 214 Points 100 badge 2x thumb
Thank You Gaurav. 
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,332 Points 20k badge 2x thumb
I would suggest the opposite - that you always use the &pagename parameter so you code is understandable and human readable. If for some reason you change the page name just change it consistently including in your code.
Photo of Gaurav Sharma

Gaurav Sharma

  • 5,756 Points 5k badge 2x thumb
Make sense my friend. :)
Photo of Intuit QuickBase

Intuit QuickBase

  • 82 Points 75 badge 2x thumb
i have one more doubt how to handle table fields with java script
Photo of Matthew Neil

Matthew Neil

  • 31,138 Points 20k badge 2x thumb
Everything within QB is handled with field IDs (fid).  You will need to pay attention to field types and acceptable formats.

I'd familiarize yourself with the API and structure to have a better idea of requirements.
https://help.quickbase.com/api-guide/index.html