Jump to content

Vitalikssssss

Caspio Evangelist
  • Content Count

    508
  • Joined

  • Last visited

  • Days Won

    51

Posts posted by Vitalikssssss

  1. Hi @maramedinan,

    Solution provided above will not work unless the code placed in HTML block (row element).

    I have created a different snippet for highlighting some particular cell that you can try. 

    Please make sure that you replace number that refer to the column number in below code. Column count starts with "1".

    The following code should go into DataPage Footer.

    <script>
    
    document.addEventListener('DataPageReady', function(event){
    
      let arr = document.querySelectorAll('td:nth-child(4).cbResultSetCalculatedField'); //change number of the column in "nth-child(4)"  
    
      arr.forEach(element => {
    
    
        if (element.innerHTML > 7) { // your target value
            
            element.style.background = 'red'; // color that would be applied on cell that meets the criteria
        }
    
      });
    
    });
    
    </script>

    Hope this helps.

    Regards,

    Vitalikssssss

  2. Hi @JanineB,

    It looks like the "$" currency sign added by formatting is the reason for element value not been recognized as a number.

    You may add a replace function with regex to remove unwanted characters from value formatted as currency.

    So, your JavaScript would look like this:

    <script>
      
    var elems = document.getElementsByTagName("td");
      
    for (var i=0, m=elems.length; i<m; i++) {
      
    if (elems[i].innerHTML.replace(/[^0-9\.-]+/g,"") > 0) { 
      
        elems[i].style.textDecoration = "line-through";
    
        }
      
    }
    </script>

    Regards,

    vitalikssssss

  3. Hi @jazmichaelking,

    It looks like G Suite supports SAML 2.0 (Security Assertion Markup Language) that also used by Caspio SAML, however G Suite is not listed as one of the Idp provider that has been verified by Caspio. I haven`t done this type of integration yet  but overall it should be possible. The only challenge I see is to understand how to store usernames in Caspio table. I guess it is possible to find out the format of user_name returned by Idp from G Suite support.

    Here are some links that should help:

    https://howto.caspio.com/authentications-and-connections/single-sign-on/

    https://support.google.com/a/answer/6087519

    Hope this helps.

    I would appreciate if you share with a community if you succeed or not.

    Regards,

    vitalikssssss   

     

     

  4. Hi @BillW,

    There is a small error in this part of your code.

    image.png

    There is no "value" attribute available for element Calculated value because value is rendered within a <span> tags.

    You would need to use "InnerHTML" property to get the text value of Calculated field.

    So, above line of code should look like this:

    let fan = document.getElementById("InsertRecordODE_Fan_TIR").innerHTML;

    Hope this helps.

    Regards,

    Vitalikssssss

  5. Hi @Elderberg,

    I would like to share a different approach, so instead of using a submit() function I have used the click() function on Submit button to mimic submit event.

    Also, it is possible to use AppKey of the Datapage in order to submit the particular Datapage if more than one is deployed.

    <script type="text/javascript">
    document.addEventListener('BeforeFormSubmit', function (event) {
      
    if (event.detail.appKey == 'XXXXXXXXXXXX') { 
      
    event.preventDefault();  
      
    //do smth before Submit
      
    document.querySelector(`#Submit${event.detail.uniqueSuffix}`).click();
      
    }
    
    });
    </script>

    Hope it helps.

    Regards,

    vitaliksssss

  6. Hi @asesores,

    That is very interesting question.

    I come up with a workaround which would allow to create a cross join between 2 tables in Caspio.

    Basically, you would need to add an additional field in both tables and specify the identical values for all records. 

    Table #1

     image.png

    Table #2

    image.png

    Create a View with Full Outer Join by the Join Field:

    image.png

    Here is a result which you shall have:

    image.png

     

    Hope this helps.

    Regards,

    vitalikssssss

     

  7. Hi @Joanne,

    the way how you reference fields is incorrect for Inline Edit action of Tabular report and also you need to use a special event to capture the moment then user clicked on Edit/Update button/link.

    You may try to use the following snippet, however make sure that name of the fields are correct and have prefix "InlineEdit".

    <script>
    
    document.addEventListener('DOMSubtreeModified', function(){
    
      
       let element = document.querySelector('[id*="InlineEdit"]');
    
       if (element) {
    
        let regExp = /^[0-9]+$/;
         
        //Change the name of the fields 
         
        let arrEl = Array.from(document.querySelectorAll('[id*="InlineEditPhone"], [id*="InlineEditEmergencyPhone"], [id*="InlineEditPhone3"]')); 
     
        arrEl.forEach(function(el) {
    
        
          el.maxLength = 14;
          
          el.addEventListener('input', function(v_e) {
              if (regExp.test(v_e.key)) {
                  this.value = this.value.substr(0, this.value.length - 1);
                return false;
            }
       
             let v_value = (this.value.replace(/[^\d]/g, ''));
         
            if (v_value.length >= 7 && v_value.length < 10) {
             this.value = (v_value.substring(0, 3) + "-" + v_value.substring(3, 7) + v_value.substring(7, v_value.length));
            } else if (v_value.length >= 10) {
      this.value = ("(" + v_value.substring(0, 3) + ") " + v_value.substring(3, 6) + "-" + v_value.substring(6, 10) +v_value.substring(10, v_value.length));
       }
      });
     });
       }
    
    });
    
    
    </script>

    Hope this helps.

    Regards,

    vitalikssssss

  8. Hi @JMR21,

    You would need to add a line of code which would click on Search/Submit button after user clicks Clear Form, so it could pass empty string parameters to other Datapages.

    So, the JS snippet could look like this:

    <button type="button" onclick="resetForm()">Clear Form</button>
    
    
    <script>
    function resetForm() {
      
        var myForm = document.querySelector('form[action*="[@cbAppKey]"]').querySelectorAll('input:not([type=submit]):not([type=hidden]), textarea, select');
        myForm.forEach(function(elem) {
        elem.value="";
      });
        var searchBtn = document.querySelector('.cbSearchButton').click();
    }
    </script>

    Regards,

    vitalikssssss

×
×
  • Create New...