Jump to content

Vitalikssssss

Caspio Rockstar
  • Content Count

    490
  • Joined

  • Last visited

  • Days Won

    47

Reputation Activity

  1. Like
    Vitalikssssss got a reaction from JMR21 in How Can I Format A Text Field As A Dollar?   
    Hi @bbewley, @kpcollier,

    You may try using this JS which should go to the Footer:
    <script type="text/javascript"> function formatAsDollars(el) { el.value = el.value.replace(/[^\d]/g,'').replace(/(\d\d?)$/,'$1').replace(/^0+/,'').replace( /\d{1,3}(?=(\d{3})+(?!\d))/g , "$&,"); el.value = el.value ? '$' + el.value : ''; } let fields = ["FIELD_1", "FIELD_2"]; //specify your fields here fields.forEach(element => { element = "InsertRecord" + element; // replace "InsertRecord" with "EditRecord" for Details/Single Record Update DP document.getElementById(element).onkeyup = function() { formatAsDollars(this); } document.getElementById(element).onchange= function() { formatAsDollars(this); } }); </script> Pay attention to comments.
    Hope this helps.
    Vitalikssssss
  2. Like
    Vitalikssssss got a reaction from Elderberg in Referencing VirtualField with weird alphanumeric appended to it by Caspio   
    Hi @Elderberg,
    I have recently found that you can get suffix from DataPage event.
    <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { let suffix = event.detail.uniqueSuffix; console.log(suffix); }); </script> Regards,
    vitalikssssss 
  3. Thanks
    Vitalikssssss reacted to Hastur in How to get the file size   
    Hello @CoopperBackpack
    You may use additional JS code to implement this workflow:
    <script type="text/javascript"> document.addEventListener('DataPageReady', fileInputEvent) function fileInputEvent() { document.querySelector("#InsertRecordFile_f"),addEventListener('change', fileInputHandler); // use the InsertRecord[your file field name] instead document.removeEventListener('DataPageReady', fileInputEvent) } function fileInputHandler(event) { const fileSizeInput = document.querySelector('#InsertRecordFile_size'); // use the InsertRecord[your file size field name] instead fileSizeInput.value = event.target.files[0].size; } </script> Insert this code into the header of the submission form. Do not forget to disable the HTML editor.
    For the file size field use the Number data type. You also may make the size field hidden in the submission form.
  4. Thanks
    Vitalikssssss reacted to Hastur in Disable Submit button   
    Hi @Caspio101
    You can implement this workflow using the JS code.
    Here is the code with comments on parts which needs to be changed according to your workflow:
    <style> /* some styles for the disabled button */ input[name="Submit"]:disabled { cursor: not-allowed !important; background-color: gray !important; } </style> <script type="text/javascript"> function inputHandler(event, elementsSelectors) { if (!!event.target.innerHTML.trim()) { let elements = elementsSelectors.map( function(selector) { return document.querySelector(selector).innerHTML.trim() }); if (elements.includes('0')) { // Here you may change the condition. Now the button will be disabled if at least one calc value is equal to 0 document.querySelector('input[name="Submit"]').disabled = true; } else { document.querySelector('input[name="Submit"]').disabled = false; } } else { return null; } } function assignEvent() { // here you may define the list of the selectors to choose calculated fields you may use in condition let elementsSelectors = ['span[id^="InsertRecordfield_1"]', 'span[id^="InsertRecordfield_2"]', 'span[id^="InsertRecordfield_3"]']; elementsSelectors.forEach(function(selector) { document.querySelector(selector).addEventListener('DOMSubtreeModified', function() { inputHandler(event, elementsSelectors); }); }); document.removeEventListener('DataPageReady', assignEvent); } document.addEventListener('DataPageReady', assignEvent); </script>  
    You need to insert this code into the header of the submission form. Do not forget to disable the HTML editor in the advanced section of the header.
  5. Like
    Vitalikssssss got a reaction from Vincent in Use external database instead of the Caspio Tables   
    Hi @Vincent,
    Your data needs to reside in Caspio tables in order to work with it via Datapages.
    You may check this article which explains how you can import your date:
    https://howto.caspio.com/tables-and-views/importing-data/
    You may also consider using REST API for transferring the data from you database into Caspio:
    https://howto.caspio.com/web-services-api/rest-api/
    Hope this helps.
    Regards,
    vitalikssssss
     
  6. Thanks
    Vitalikssssss reacted to DesiLogi in Change style for 'Bulk Edit' link on hover   
    Hi,
    Does anyone know how/where to change the css in the Styles for the Bulk Edit link when it's hovered over, for a tabular datapage. I can change the style for the link in Source/Page Action section: 
    .cbResultSetBulkEditActionLink
    {
        /*Results Page Bulk Edit ActionLink Attributes (For Gallery And List Pages)*/
        color: green;
        font-family: Arial, sans-serif;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
    }
    However, this only changes the link style when it's not hovered over. When hovered over  the 'Bulk Edit' link reverts to its default styling and looks jarring. There must be some css somewhere for something like .cbResultSetBulkEditActionLink:hover but I cannot find it. 
    EDIT:
    In case anyone needs a solution to something like this, I ended up sort of finding a solution. If you put _hover after it (what Caspio seems to use to designate hover), it basically removes the hover effect (it's supposed to change it, if you change the css but it seems to have just disabled hover). So if you put something like:
    .cbResultSetBulkEditActionLink
    {
        /*Results Page Bulk Edit ActionLink Attributes (For Gallery And List Pages)*/
        color: green;
        font-family: Arial, sans-serif;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
    }
    .cbResultSetBulkEditActionLink_hover
    {
        /*Results Page Bulk Edit ActionLink Attributes (For Gallery And List Pages)*/
        color: green;
        font-family: Arial, sans-serif;
        font-size: 14px;
        font-weight: 800;
        text-decoration: none;
    }
    in Source/User Defined Styles it seems to work. 
  7. Thanks
    Vitalikssssss got a reaction from mgredmond in Populate Field 2 Based on Value of Field 1   
    Hi @mgredmond,
    You can add your actual field into submission form and use Calculated value form element to reference the result of Virtual field.
    Advanced Calculated value settings allows you to hide field.

    The formula expression will need to have a CASE logic block because Calculated value works with "Value" section of dropdown.
    It might look like this:

    Hope it helps.
    Regards,
    Vitalikssssss
  8. Like
    Vitalikssssss got a reaction from kpcollier in Task to send email with multiple records   
    Caspio Bridge 21.0 release brought a Tasks\Trigger enhancement which solve this case without complex Trigger\Tasks.
    There is a new block added to Triggered Action called "Table variable" which forms a table.
     
    You can insert table variable into email body and it will be formed link a table (HTML format enabled):

    Hope it helps someone.
     
  9. Like
    Vitalikssssss got a reaction from kpcollier in Format Currency With Custom Calculations   
    Hi @kpcollier,
    Try the following JavaScript:
    <script type="text/javascript"> function formatAsDollars(el) { el.value = el.value.replace(/[^\d]/g,'').replace(/(\d\d?)$/,'$1').replace(/^0+/,'').replace( /\d{1,3}(?=(\d{3})+(?!\d))/g , "$&,"); el.value = el.value ? '$' + el.value : ''; } var fields = ["Subtotal", "MarkUp", "County_Tax", "Misc_Percent", "Freight_Total"]; //specify your fields here fields.forEach(element => { element = "InsertRecord" + element; // replace "InsertRecord" with "EditRecord" for Details/Single Record Update DP document.getElementById(element).onkeyup = function() { formatAsDollars(this); } document.getElementById(element).onchange= function() { formatAsDollars(this); } }); function calculate() { var subTotal = document.getElementById("InsertRecordSubtotal").value.length == 0 ? 0 : (parseFloat(document.getElementById("InsertRecordSubtotal").value.replace(/[$,]+/g,""))); var markUp = document.getElementById("InsertRecordMarkUp").value.length == 0 ? 0 : (parseFloat(document.getElementById("InsertRecordMarkUp").value.replace(/[$,]+/g,""))); var countyTax = document.getElementById("InsertRecordCounty_Tax").value.length == 0 ? 0 : (parseFloat(document.getElementById("InsertRecordCounty_Tax").value.replace(/[$,]+/g,""))); var miscPerc = document.getElementById("InsertRecordMisc_Percent").value.length == 0 ? 0 : (parseFloat(document.getElementById("InsertRecordMisc_Percent").value.replace(/[$,]+/g,""))); var freight = document.getElementById("InsertRecordFreight_Total").value.length == 0 ? 0 : (parseFloat(document.getElementById("InsertRecordFreight_Total").value.replace(/[$,]+/g,""))); var markUpTotal = document.getElementById("InsertRecordMarkUp_Total").value = (subTotal) * (markUp); var countyTaxTotal = document.getElementById("InsertRecordCountyTax_Total").value = (subTotal) * (countyTax); var miscPercTotal = document.getElementById("InsertRecordMisc_Percent_Total").value = (subTotal) * (miscPerc); var total = document.getElementById("cbParamVirtual1").value = (subTotal) + (markUpTotal) + (countyTaxTotal) + (miscPercTotal) + (freight); var dp_el = [ document.getElementById("InsertRecordMarkUp_Total"), document.getElementById("InsertRecordCountyTax_Total"), document.getElementById("InsertRecordMisc_Percent_Total"), document.getElementById("cbParamVirtual1") ]; dp_el.forEach(element => formatAsDollars(element)); } setInterval(calculate, 1500); </script> Regards,
    vitalikssssss
  10. Like
    Vitalikssssss got a reaction from norkaman in Passing non-Table field Parameters via Query String   
    Hi @norkaman

    Do you use the following syntax to reference first 2 parameters? 
    [@WID] and [@LBE]?
    Regards,
    vitalikssssss
  11. Like
    Vitalikssssss got a reaction from Chrille in Change the value of a field in a detailspage on update.   
    Hi @Chrille,
    You should use "EditRecord" prefix on Details page in order to reference a field.
    So, you code should look like this:
    <script type="text/javascript"> document.addEventListener('BeforeFormSubmit', function (event) { var v3 = '<img src="http://image_url" alt="YES"'; var v2 = document.getElementById("EditRecordKontaktad").value; if (v2 !="") { document.getElementById("EditRecordRingt").value = v3; }}); </script> Hope this helps.
    Regards,
    vitalikssssss
  12. Like
    Vitalikssssss got a reaction from kpcollier in How Can I Format A Text Field As A Dollar?   
    Hi @bbewley, @kpcollier,

    You may try using this JS which should go to the Footer:
    <script type="text/javascript"> function formatAsDollars(el) { el.value = el.value.replace(/[^\d]/g,'').replace(/(\d\d?)$/,'$1').replace(/^0+/,'').replace( /\d{1,3}(?=(\d{3})+(?!\d))/g , "$&,"); el.value = el.value ? '$' + el.value : ''; } let fields = ["FIELD_1", "FIELD_2"]; //specify your fields here fields.forEach(element => { element = "InsertRecord" + element; // replace "InsertRecord" with "EditRecord" for Details/Single Record Update DP document.getElementById(element).onkeyup = function() { formatAsDollars(this); } document.getElementById(element).onchange= function() { formatAsDollars(this); } }); </script> Pay attention to comments.
    Hope this helps.
    Vitalikssssss
  13. Thanks
    Vitalikssssss got a reaction from Glitch in How Can I Format A Text Field As A Dollar?   
    Hi @bbewley, @kpcollier,

    You may try using this JS which should go to the Footer:
    <script type="text/javascript"> function formatAsDollars(el) { el.value = el.value.replace(/[^\d]/g,'').replace(/(\d\d?)$/,'$1').replace(/^0+/,'').replace( /\d{1,3}(?=(\d{3})+(?!\d))/g , "$&,"); el.value = el.value ? '$' + el.value : ''; } let fields = ["FIELD_1", "FIELD_2"]; //specify your fields here fields.forEach(element => { element = "InsertRecord" + element; // replace "InsertRecord" with "EditRecord" for Details/Single Record Update DP document.getElementById(element).onkeyup = function() { formatAsDollars(this); } document.getElementById(element).onchange= function() { formatAsDollars(this); } }); </script> Pay attention to comments.
    Hope this helps.
    Vitalikssssss
  14. Like
    Vitalikssssss got a reaction from kpcollier in Total * Markup * Tax in JavaScript   
    @kpcollier,
    You can use the following JS code if you decide to use a custom code.
    <script type="text/javascript"> function calculate() { var subTotal = isNaN(parseFloat(document.getElementById("InsertRecordSubtotal").value)) ? 0 : parseFloat(document.getElementById("InsertRecordSubtotal").value); var markUp = isNaN(parseFloat(document.getElementById("InsertRecordMarkUp").value)) ? 0 : parseFloat(document.getElementById("InsertRecordMarkUp").value) ; var countyTax = isNaN(parseFloat(document.getElementById("InsertRecordCounty_Tax").value)) ? 0 : parseFloat(document.getElementById("InsertRecordCounty_Tax").value); var miscPerc = isNaN(parseFloat(document.getElementById("InsertRecordMisc_Percent").value)) ? 0 : parseFloat(document.getElementById("InsertRecordMisc_Percent").value); var freight = isNaN(parseFloat(document.getElementById("InsertRecordFreight_Total").value)) ? 0 : parseFloat(document.getElementById("InsertRecordFreight_Total").value); var markUpTotal = document.getElementById("InsertRecordMarkUp_Total").value = (subTotal) * (markUp); var countyTaxTotal = document.getElementById("InsertRecordCountyTax_Total").value = (subTotal) * (countyTax); var miscPercTotal = document.getElementById("InsertRecordMisc_Percent_Total").value = (subTotal) * (miscPerc); document.getElementById("cbParamVirtual1").value = (subTotal) + (markUpTotal) + (countyTaxTotal) + (miscPercTotal) + (freight); } setInterval(calculate, 1500); </script> Regards,
    vitalikssssss
  15. Thanks
    Vitalikssssss reacted to BFuchs in Task to send email with multiple records   
    Hi,
    The suggested method is not available yet.
    Here is another way to accomplish it.
    Create a calculated field with something like below and have this as part of the email body.
    SELECT snv_id = 'Not updating your browser already resulted in the following records being submitted with missing info:' + char(10) + STUFF(( SELECT ', ' + snv_id + ' ' + CONVERT(VARCHAR(10), Visit_Date, 101) + ' ' + Client_Last_Name + ' ' + ' ' + Client_First_name + char(10) FROM _v_v_VisitNotes_Browser where _v_v_VisitNotes_Browser.nurse_User_ID_num_SNV= '[@authfield:Nurse_UserName]' FOR XML PATH('') ), 1, 1, '')  
  16. Thanks
    Vitalikssssss reacted to Alison in Add a value from the Dropdown field to the Text field   
    Hi @Vitalikssssss,

    You should add two text fields to the Selected fields on the Submission form and one of them make a Dropdown form element. After that create a Header and Footer element and past the following code into the footer after disabling HTML edotir:

     
    <script> document.addEventListener("DataPageReady", function() { let dropdown = document.getElementById('InsertRecordname'); let textfield = document.getElementById('InsertRecordnumber'); let change = function() { textfield.value = this.options[this.selectedIndex].value; }; if (document.addEventListener !== undefined) { dropdown.addEventListener('change', change, true); } else if (document.attachEvent) { dropdown.attachEvent('onchange', change); } else { dropdown.onchange = change; } }); </script> InsertRecordname and InsertRecordnumber are the ids of the text fields elements  where InsertRecordname is set to the Dropdown form element.

      

  17. Thanks
    Vitalikssssss got a reaction from Ed727 in Auto-submit form only on initial load   
    Hi @Ed727,
    I assume that you have both Datapages deployed on a web-page with an embed method.
    You can use a JS which clicks on Submit button if my assumption is correct.
    Here a a code which you can use on web-page:
    <script> function submit () { document.querySelector("input[id*='Submit']").click(); } setTimeout(submit, 5000); </script> Hope this helps.
    Regards,
    vitalikssssss
  18. Like
    Vitalikssssss got a reaction from lypoextract in How do you port applications to multiple platforms?   
    Hi @lypoextract,
    You can use import/export of application if you would like to transfer it to different account.
    Here is a documentation: https://howto.caspio.com/apps/exporting-an-app/
    Hope this helps.
    Regards,
    vitalikssssss
  19. Thanks
    Vitalikssssss got a reaction from Elderberg in Date Range on Submission Form   
    Hi @Elderberg,
    I can suggest using a simple Dropdown or Listbox for date selection and a lookup table which will be updated via Tasks on daily basis.
    Here is an example of Task which adds yesterdays, current date, and tomorrows date on daily basis.

    You may also import this Task from attached archive.
    Hope this helps.
    Regards,
    vitalikssssss
    CaspioData_2019-Dec-02_1638.zip
  20. Like
    Vitalikssssss got a reaction from irumlailoo in data transfer   
    Hi @Yolanda,
    You can find answer in this blog post:
    https://blog.caspio.com/update-on-caspios-data-transfer-policy/
    Regards,
    vitalikssssss
  21. Like
    Vitalikssssss got a reaction from wimtracking2 in js Multi-select for 3 Listboxes on same Submit datapage   
    Hi @DesiLogi,
    Try using the following script in the Footer of the Datapage:
    <script type="text/javascript"> function f_listbox(v_state) { if ( v_state.indexOf(",") > 0 ) { for (let i=0 ; i < o_state.options.length; i++ ) { if(o_state[i].value == v_state) { o_state.remove(i); break ; } } let o_st = v_state.split(", ") ; for (let j=0 ; j < o_st.length; j++) { for (let i=0 ; i < o_state.options.length; i++ ) { if(o_st[j]== o_state.options[i].value){ o_state.options[i].selected = true ; break ; } } } } } document.addEventListener('DataPageReady', function (event) { let v_state = ["CompanyName", "FirstName", "LastName"]; //Field names goes here let o_state = []; v_state.forEach(function(el) { if (el !== null) { o_state.push(document.getElementById("EditRecord"+el)); } }); o_state.forEach(function(el){ if (el !== null) { el.multiple = true; } }); f_listbox(v_state); }); </script>  
  22. Like
    Vitalikssssss got a reaction from RickManolo in Add text field entry to a text area   
    Hi @RickManolo,
    Well, for me the easiest way to do this is to use a Virtual field to display "Notes" and make an actual field "Notes" as hidden.
    I assume that you use Single Record Update or Details Datapage. 
    If the answer for above is yes, you can use the following JS code to concat existing Note with AddNote input after Update of the record.
    <script type="text/javascript"> document.addEventListener('BeforeFormSubmit', function (event) { let target = document.querySelector('[id*="EditRecordNotes"]'); let n_notes = document.querySelector('input[id*="EditRecordAdd_Note"]').value; let o_notes = document.querySelector('input[name*="cbParamVirtual1"]').value; target.value = o_notes + n_notes; }); </script> Change the name of the fields if necessary, and also make sure you disable HTML editor prior to pasting the code.
    Hope this helps.
    Regards,
    vitalikssssss 
     
     
  23. Like
    Vitalikssssss got a reaction from GWBjr in Record Level Access based on partial field match   
    @GWBjr

    Try this expression:
    'www.' + Substring([@field:Email], ((Charindex('@', [@field:Email]))+1), Len([@field:Email])) Regards,
    vitalikssssss
  24. Thanks
    Vitalikssssss got a reaction from Ed727 in Line breaks in Text(64000) fields not recognized in html block insert   
    Hi @Ed727,
    I am afraid that long text without HTML tags  will be rendered as a single line string.
    Regards,
    vitalikssssss
  25. Thanks
    Vitalikssssss reacted to kpcollier in Make JS Work With Empty Fields   
    Haha, wow. Your code looks SO nice, specially compared to the way I did it. Thank you @Vitalikssssss it works great.
×
×
  • Create New...