Jump to content

Vitalikssssss

Caspio Evangelist
  • Content Count

    508
  • Joined

  • Last visited

  • Days Won

    51

Posts posted by Vitalikssssss

  1. Hi @DonateGoodStuff,

    I believe you have used legacy format embed code for deploying your Datapages. 

    Caspio has introduced Asynchronous loading of their Datapage a year or so ago and they also changed the format of embed code.

    Async loading gives a better performance for Datapage loading.

    Some Javascript events such as document.write(), onload() is not supported with Async loading.

    I assume that you have some Javascript (perhaps from TechTips section in HowTo) in either Header, Footer, HTML blocks which has described Javascript event handlers.

    I can suggest contacting Caspio Support who can help you to resolve this type of issues.

    Regards,

    vitalikssssss

  2. Hi @GWBjr,

    You may need to utilize Formula field in table where you store user information (auth. table) in order to sub struct domain name and add global domain.

    You can use the following expression in the Formula field:

    'www.' + Substring([@field:Email], (Charindex('@', [@field:Email])), Len([@field:Email]))

    Finally, you can use this field in Record-Level-Security in order to accomplish your workflow.

    Regards,

    vitalikssssss

     

     

  3. Hi @ManonG,

    You can use the following script in Datapage Footer:

    <script type="text/javascript">
    document.addEventListener('DataPageReady', function (event) {
    	document.querySelector('[id*=InsertRecord*YOUR_DROPDOWN_FIELD*]').addEventListener('change', function() {
            let item = document.querySelector("select[id='InsertRecord*YOUR_DROPDOWN_FIELD*']").value;
            document.querySelector("input[id='InsertRecord*YOUR_TEXT_FIELD*']").value = item;   
        });
    });
    </script>

    Please note that this JS code designed for Submission Form Datapage. Also, make sure you disable HTML editor and change *YOUR_DROPDOWN_FIELD* & *YOUR_TEXT_FIELD* to your actual field names.

    Hope this helps.

    Regards,

    vitalikssssss

  4. Hi @Ras2019,

    The way you trying to refer to Virtual fields is incorrect. 

    I would recommend using query selectors with contains type of match.

    This code should work fine:

    <script type="text/javascript">
    
    document.addEventListener('BeforeFormSubmit', function(event) {
    
    var Input1 = document.querySelector("span[id^='cbParamVirtual1']").innerHTML;
    
    var Input2 = document.querySelector("span[id^='cbParamVirtual2']").innerHTML;
    
         if (Input1 === 'WARNING' || Input2 === 'WARNING') {
    event.preventDefault();
    
    alert('Enter acceptable volume!');
    
    
    } else {
    
    document.forms["caspioform"].submit();
    
    }
    
    });
    </script>

    Regards,

    vitalikssssss

  5. Hi @rgiljohann,

    My previous solution is a bit outdated because Caspio introduced their built-in event handlers. 

    Please try the following updated script:

    1. Datapage Header:

    <style>
    #doublescroll
    {
      overflow: auto; overflow-y: hidden; 
    }
    #doublescroll p
    {
      margin: 0; 
      padding: 1em; 
      white-space: nowrap; 
    }
    </style>
    
    <div id="doublescroll">

    2. Datapage Footer:

    </div>
    <script type="text/javascript">
    function DoubleScroll(element) {
        var scrollbar = document.createElement('div');
        scrollbar.appendChild(document.createElement('div'));
        scrollbar.style.overflow = 'auto';
        scrollbar.style.overflowY = 'hidden';
        scrollbar.firstChild.style.width = element.scrollWidth+'px';
        scrollbar.firstChild.style.paddingTop = '1px';
        scrollbar.firstChild.appendChild(document.createTextNode('\xA0'));
        scrollbar.onscroll = function() {
        element.scrollLeft = scrollbar.scrollLeft;
        };
        element.onscroll = function() {
        scrollbar.scrollLeft = element.scrollLeft;
        };
        element.parentNode.insertBefore(scrollbar, element);
    }
    
    
    
    
    document.addEventListener('DataPageReady', DoubleScroll(document.getElementById('doublescroll')));
    </script>

    This should help.

    Regards,

    vitalikssssss

  6. Hi @CarbonArchitect,

    It is possible to place top menu bar with a help of JS code snippet from below:

            <script type="text/javascript">
    
                function movePA(event) {
                
                    var pa = document.querySelector("table[id^='PageActionsCtnr']");
                    var nb = document.querySelector("table[id^='NavigationTableBottom']");
    
                    nb.parentNode.insertBefore(pa, nb.nextSibling);
                
                }
    
                document.addEventListener('DataPageReady', movePA);
                </script>

    Place above code into Datapage footer (ResultSet section). 

    Make sure you you disable HTML editor.

    Hope this helps.

    Regards,

    vitalikssssss

     

  7. Hi @dmarlowe,

    I believe you should create mediatory table as explained in Many-To-Many tutorial video.

    Finally, you should use this mediatory table as a Datasource for Tabular report with "Inline insert" option enabled.

    This method will allow you to submit more than one record with different ID`s from businesses and categories.

    You should consider "List String" datatype if you would like to have check-box type of selection, however you will not be able to create relationship as described above. 

    Hope this helps.

    Regards,

    vitalikssssss

     

  8. Hi @Ras2019,

    You should wrap your SQL query with brackets and also use "0/1" for checkbox field comparison.

    So, your formula should look like this:

    CASE
    
    WHEN [@field:Agree]=0 AND [@field:Term]="Disc1" 
    
    THEN
    
    (SELECT Price FROM Products WHERE Model=target.[@field:Model] AND Color=target.[@field:Color]) 
    
    WHEN [@field:Agree]=1 AND [@field:Term]="Disc1" 
    
    THEN
    
    (SELECT PriceReb FROM Products WHERE Model=target.[@field:Model] AND Color=target.[@field:Color]) 
    
    END

    Hope this helps.

    Regards,

    vitalikssssss

  9. Hi @rgiljohann,

    There is an easier way how you can pass a parameter from URL to an Iframe.

    You can simple paste the parameter into Iframe src e.g. 

    <iframe src="URL?HHAIPName=[@HHAIPName]" width="100%" height="1000" type="text/html" frameborder="0" style="border: 0">

    This should help you to remove your JS code and <noscript> tags.

    Regards,

    Vitalikssssss

  10. Hi @kpcollier,

    Indeed there was a case which I did not think through.

    Here is a code which should resolve the issue:

    <script type="text/javascript">
    
    document.addEventListener('DataPageReady', function (event) {
    
    let v_fields = ["Labor1_Rate", "Labor1_Hours", "Labor2_Rate", "Labor2_Hours", "Labor3_Rate","Labor3_Hours",
    "Labor4_Rate", "Labor4_Hours", "Labor5_Rate", "Labor5_Hours", "Labor6_Rate", "Labor6_Hours", "Labor7_Rate", "Labor7_Hours",
    "Labor8_Rate", "Labor8_Hours", "Labor9_Rate", "Labor9_Hours", "Labor10_Rate", "Labor10_Hours", "Labor11_Rate", "Labor11_Hours",
    "Labor12_Rate", "Labor12_Hours", "Labor13_Rate", "Labor13_Hours", "Labor14_Rate", "Labor14_Hours", "Labor15_Rate", "Labor15_Hours",
    ]; 
    
    let t_field = ["Labor1_Total", "Labor2_Total", "Labor3_Total", "Labor4_Total", "Labor5_Total", "Labor6_Total", 
                    "Labor7_Total", "Labor8_Total", "Labor9_Total", "Labor10_Total", "Labor11_Total", "Labor12_Total",
                    "Labor13_Total", "Labor14_Total", "Labor15_Total",]; 
    
    let sub_total = document.getElementById("InsertRecordLabor_SubTotal");
    
    sub_total.value = 0;
    
    let v_state = [];
    
    let t_state = [];
    
    v_fields.forEach(function(el) {
    
        if (el !== null) {
                v_state.push(document.getElementById("InsertRecord"+el));
        }
     });
    
    v_state.forEach(function(el){
        if (el !== null) {
                el.addEventListener("keyup", calculate);
                
    
        }
    });
    
    t_field.forEach(function(el) {
    
       if (el !== null) {
               t_state.push(document.getElementById("InsertRecord"+el));
       }
    });
    
    function calc_total(){
        sub_total.value = 0;
        t_state.forEach(element => { 
            if (element !== null) {
            sub_total.value = +sub_total.value + +element.value;
            }
        });
    
    }
    
    
    
    function calculate() {
    
        let i = 0;
    
        t_state.forEach(element => { 
    
            if (element !== null) {
                
                element.value = ((!isNaN(v_state[i].value)) ? v_state[i].value : 0) *
                
                            ((!isNaN(v_state[i+1].value)) ? v_state[i+1].value : 0);
                
                i+=2;
        }
        
            
        });
    }
    
    setInterval(calc_total, 2000);
    
    
    });
    
    </script>

    Regards,

    vitalikssssss 

×
×
  • Create New...