Discussions

Expand all | Collapse all

QuickBase Scripting & Data Field Validation

  • 1.  QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 22:44
    I understand that there is ability to use ... is it Javascript? ...scripting in QBase to accomplish things that are not straight out of the UI.  

    First question, is this Javascript or something else?

    Second is, where is some info on how to use JS to add functionality.  I know JS but not how it fits into QBase.

    Third is, the problem at hand for me is to do some field level numeric validation to eliminate common input errors in forms.  Is this the way to do it, with JS?  Or is there some other method.

    I am an software engineer but just learning QBase for a customer project.  My searches aren't producing much in the way of "where do I start"?  All I really need is a pointer and example or two and I'm off to the races.

    Thanks for any help!!!

    Stephen


  • 2.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 22:54
    If you can give an example of the validation rules, there may be a simple way to create a formula which calculates if the data is valid.  Then you can have a form rule to block the save if the data is not valid.


  • 3.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 22:59
    For a numeric field, ability to limit to, say, a range between 91.5 and 94.8.
    Or integer between 0 and 99.
    Or...  etc.

    If you type in something wrong it either stops you or pops up an error.  Typical validation stuff.

    I know that some stuff like typing alpha characters into numeric is already handled.

    What's a formula...?  I'll go check that out in the user guide.


  • 4.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 23:05
    An example of a formula is a formula field called Valid? of type formula checkbox

    IF([entry field] >=91.5 and [entry field] <= 94.8,true, false)

    which is equialent to
    IF([entry field] >=91.5 and [entry field] <= 94.8,true)

    which is also equivalent to 

    [entry field] >=91.5 and [entry field] <= 94.8

    ie with a boolean you can make a statement and the system either says its true or called Bullshit on you and says its false.


  • 5.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 23:09
    Great - I'll look up formulas and give this a try!  Sounds promising.

    Thanks so much.


  • 6.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 23:12


  • 7.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 23:14
    Wow that is truly handy!  Formula wielding folks, follow that link...!


  • 8.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-13-2017 23:57
    When you go to build a formula, there is also a help in the box, but this info is all in one place, so you
    get a nice overview of all the formulas.

    Also check out the Help text on formula variable. it makes your fomulas more readable.
    http://help.quickbase.com/user-assistance/#formula_variables.html?Highlight=formula variables


  • 9.  RE: QuickBase Scripting & Data Field Validation

    Posted 04-14-2017 03:14
    This is Dan D's "library" of all sorts of .js add-ons for QB.

    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=td

    if you want to use a js page automatically you will want to start with the "Image Onload" Technique.  But most everything can run with a button click.


  • 10.  RE: QuickBase Scripting & Data Field Validation

    Posted 05-02-2017 05:50
    Dear Stephen, There is alternative to achieve this requirement using javascript.

    Please follow below steps.
    1. First Configure Dan's Image onload technique.
    2. https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=294&_ga=2.233694235.40686674...
    3. In your module.js code page ,  you can write javascript function as below to validate the character length in any numeric field. In field fid_147. if user enters digit more than or less than 6 then it will prompt error and clear the value from the same field.
    ---------------------------------------------------------------------------------------
    $('#_fid_147').focusout(function(){ 
    if ($('#_fid_147').val() != '' && $('#_fid_147').val().length != 6) { 
    alert('The PID should be 6 character');
    $('#_fid_147').val('');
    $('#_fid_147').focus();

    });
    ---------------------------------------------------------------------------------------
    $('#_fid_16').focusout(function(){ 
    if ($('#_fid_16').val() != '' && $('#_fid_16').val().length != 8) { 
    alert('The FW# should be 8 character');
    $('#_fid_16').val('');
    $('#_fid_16').focus();

    });
    ---------------------------------------------------------------------------------------
    I hope this will help you.

    Regards,
    Rahul