Forum Discussion
JoshuaTate
8 years agoQrew Cadet
Works perfectly, i use Chrome, also used it in IE as well. Only the below code is put into a URL Button, the rest comes from the AddWR.js.
"javascript:" &
"var F3= " & URLEncode([Record ID#]) & ";" &
"var F9= '" & [Number of Store Visits Required ? ] & "';" &
"var F72= '" & [Related Project] & "';" &
"var F77= '" & [Related Site] & "';" &
"var F98= '" & [Type of Scope] & "';" &
"var F84= '" & [Project - Related customer] & "';" &
"var F100= '" & [Date of Issue] & "';" &
"var F999= '" & "Installation" & "';" &
"var F21= '" & [Visit 1 Date] & "';" &
"var F22= '" & [Visit 1 Time] & "';" &
"var F23= '" & [Visit 1 Labour Qty] & "';" &
"var F25= '" & [Visit 2 Date] & "';" &
"var F26= '" & [Visit 2 Time] & "';" &
"var F27= '" & [Visit 2 Labour Qty] & "';" &
"var F29= '" & [Visit 3 Date] & "';" &
"var F30= '" & [Visit 3 Time] & "';" &
"var F31= '" & [Visit 3 Labour Qty] & "';" &
"var F33= '" & [Visit 4 Date] & "';" &
"var F34= '" & [Visit 4 Time] & "';" &
"var F35= '" & [Visit 4 Labour Qty] & "';" &
"var F37= '" & [Visit 5 Date] & "';" &
"var F38= '" & [Visit 5 Time] & "';" &
"var F39= '" & [Visit 5 Labour Qty] & "';" &
"var F41= '" & [Visit 6 Date] & "';" &
"var F42= '" & [Visit 6 Time] & "';" &
"var F43= '" & [Visit 6 Labour Qty] & "';" &
"var F45= '" & [Visit 7 Date] & "';" &
"var F46= '" & [Visit 7 Time] & "';" &
"var F47= '" & [Visit 7 Labour Qty] & "';" &
"var F49= '" & [Visit 8 Date] & "';" &
"var F50= '" & [Visit 8 Time] & "';" &
"var F51= '" & [Visit 8 Labour Qty] & "';" &
"var F53= '" & [Visit 9 Date] & "';" &
"var F54= '" & [Visit 9 Time] & "';" &
"var F55= '" & [Visit 9 Labour Qty] & "';" &
"var F57= '" & [Visit 10 Date] & "';" &
"var F58= '" & [Visit 10 Time] & "';" &
"var F59= '" & [Visit 10 Labour Qty] & "';" &
"$.getScript('" & URLRoot() & "db/[DBID]?act=dbpage&pagename=AddWR.js');void(0);"
- JoshuaTate8 years agoQrew CadetAs well as asking for help when I just can't work something out. I have only 8 years VBA experience (with specific use cases as I am self-taught) so interesting learning curve moving to Javascript.
- _anomDiebolt_8 years agoQrew EliteThat makes more sense.
Here is another mechanism I sometimes use to pass field values to script.
Here is a Rich Text field styled as a button: that places two fields [Record ID#] and [Name] into attributes of the <a> element:[iol] & "module.js" & [/iol]
The <a> portion of the generated field looks like this:
&
"<a class='QBU_Button Vibrant Success' " &
" data-rid='" & [Record ID#] & "'" &
" data-name='" & [Name] & "'" &
">Button</a>"<a
Within the module.js file you can gain access to the field values like this:
class="QBU_Button Vibrant Success"
data-rid="1"
data-name="Jane Doe" >Button</a>$("a.QBU_Button").on("click", function(event) {
This allows you to style the button anyway you want and provides nice isolation between the formula and script.
var rid = this.dataset.rid;
var name = this.dataset.name;
console.log("rid=", rid);
console.log("name=", name);
}); - _anomDiebolt_8 years agoQrew EliteAlso, I sometimes pass just the [Record ID#] and within the module.js make an AJAX call for any of the other fields values you need to access. This makes every thing dead simple with very good isolation between formula and script.
- JoshuaTate8 years agoQrew CadetBrilliant thank you so much - I am in the process of building out my application, no doubt the IOL technique will be used in spades.
I look forward to our future correspondence. My plan is as i work through my different use cases that i post on here for anyone looking to do similar functions where i cant see a solution already posted. - _anomDiebolt_8 years agoQrew EliteKeep going.
We have to levelup the other QuickBase users to use script so we can get into fun stuff like QuickBase Machine Learning and stop complaining about trifles like the color scheme.