Forum Discussion
_anomDiebolt_
8 years agoQrew Elite
So easy:
Tax ID Auto Format ~ Add New Record
https://haversineconsulting.quickbase.com/db/bnfj79i2f?a=nwr
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=620
Notes:
(1) I did this pretty fast and there are a few things to add. The script is responding to keyup events so if you were to paste a string into the field it will not apply the formatting.
(2) You can enter a misplaced "." , "-" or "/" character and it will not be disallowed
(3) maybe some other weird edge cases but they are easy to fix.
Tax ID Auto Format ~ Add New Record
https://haversineconsulting.quickbase.com/db/bnfj79i2f?a=nwr
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=620
Notes:
(1) I did this pretty fast and there are a few things to add. The script is responding to keyup events so if you were to paste a string into the field it will not apply the formatting.
(2) You can enter a misplaced "." , "-" or "/" character and it will not be disallowed
(3) maybe some other weird edge cases but they are easy to fix.
- SergioSergio8 years agoQrew CadetMy friend, you are awesome!
I have been following all your information, and I try to use most of your material, but I think I am not so smart when it comes to quickbase.
I am creating a field url formula, I paste your code there, but it always shows me error messages. I think i need to learn still how to apply all your codes, which fields to use etc.
Is there a video somewhere that i could learn how to use your codes in my applications? I have searched the whole internet and cant find one that shows me the step by step. Or a guide would work too.
Thank you so much and enjoy your show! - _anomDiebolt_8 years agoQrew EliteMany of my solutions involve using JavaScript which is not the same as QuickBase's formula language. The problem you are having is that you are attempting to paste my JavaScript code directly into the formula definition.
The way to use the script is to set up a special rich text field and place it on the form using a technique called the image onload technique (IOL technique) and described here:
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=294
There are hundreds of similar scripts in the pastie database which use the IOL technique (and other scripting techniques). If you need help beyond the resources in the forum or the pastie database you can ask further questions here and I will answer as time permits or you can contact me directly using the info in my profile:
https://getsatisfaction.com/people/dandiebolt - SergioSergio8 years agoQrew CadetThank you so much. I left you a message on your phone number and also texted you.
I guess I am stuck in the 1st step where i need to insert a "user defined variable". Can you give me a hint here? i feel after that i will be able to follow the other steps.
Thank you! - _anomDiebolt_8 years agoQrew Elite
I am a consultant and while I often work on the weekend I am just following up on some email and leftover tasks and I probably won't be available till Monday.
Can probably answer via the forum:
To create the two user defined variables:
Navigate: Dashboard | Settings | Variables | New Variable
Should look like this when done:
User defined variables are sort of like fields which once created are available in every table so they can be used in formulas. They are often used to provide a application wide "parameter" to a formula. In the case of the IOL technique the two variables [iol] and [/iol] are used to so you don't have to type in some very odd looking strings every time you want to use the IOL - in other words once you create these two user defined variables they can be user repeatedly by just creating a new rich text formula like so:
[iol] & "moduleTable.js" & [/iol]
moduleTable.js is the name of the code page where the script goes. - SergioSergio8 years agoQrew CadetYou are the best!
I will probably talk to you next week to get a quote on some features i need to implement. I will send you an email ok?
Thank you so much! - _anomDiebolt_8 years agoQrew EliteEmail is always the best way to reach me: dandiebolt@gmail.com
- SergioSergio8 years agoQrew CadetI just finished setting up.
Now, I am trying to figure out how do I use your codes.
IOL Field: [iol] & "module.js" & [/iol]
1) I need to create a field text enrich with this name, or create a field name taxid and insert this code in it?
Content Type: IOL ModuleContent
2) I understand here that i need to paste this into the formula field area somewhere, but not sure where?
I think I am just missing the last steps to get this done.
I am really sorry for the dummy questions.
$("#_fid_6").on("keyup", function() {
var taxid = $(this).val().replace(/[^0123456789./\-]/g, "");
if (taxid.length == 3) {
taxid += ".";
} else if (taxid.length == 7) {
taxid += ".";
} else if (taxid.length == 10) {
taxid += "/";
} else if (taxid.length == 15) {
taxid += "-";
} else if (taxid.length > 18) {
taxid = taxid.substr(0, 18);
}
$(this).val(taxid);
}); - _anomDiebolt_8 years agoQrew EliteThat code is applying the taxid formatting to the field with fid=6. To apply it to another field you have to substitute the appropriate field number:
$("#_fid_7").on("keyup", function() {...}
Also, I often times write code like this and manually apply it from the console. In such cases I often leave off the decoding logic that probably should be applied which restricts on which pages the code runs. The code will probably work as is but it should probably look like this instead:(function(){
var querystring=document.location.search;
if (/a=nwr/i.test(querystring)) {
$("#_fid_6").on("keyup", function() {
var taxid = $(this).val().replace(/[^0123456789./\-]/g, "");
if (taxid.length == 3) {
taxid += ".";
} else if (taxid.length == 7) {
taxid += ".";
} else if (taxid.length == 10) {
taxid += "/";
} else if (taxid.length == 15) {
taxid += "-";
} else if (taxid.length > 18) {
taxid = taxid.substr(0, 18);
}
$(this).val(taxid);
});
}
})(); - SergioSergio8 years agoQrew CadetMan, this is the happiest day of my life! I got it to work. Now I understand.
So, everytime I need to use one of your codes, I need to create another page or I can just paste it under the other code in the same module.js page?
I know it might be a stupid question, but I use the same page or I create other pages with watherver name I want and paste the code there? - SergioSergio8 years agoQrew CadetMan, this is the happiest day of my life! I got it to work. Now I understand.
So, everytime I need to use one of your codes, I need to create another page or I can just paste it under the other code in the same module.js page?
I know it might be a stupid question, but I use the same page or I create other pages with watherver name I want and paste the code there?