Jump to content

Vitalikssssss

Caspio Rockstar
  • Content Count

    477
  • Joined

  • Last visited

  • Days Won

    45

Vitalikssssss last won the day on May 5

Vitalikssssss had the most liked content!

About Vitalikssssss

  • Rank
    Advanced Member

Recent Profile Visitors

2,056 profile views
  1. Hi @mhand, You may try to use the following JavaScript snippet: <script> document.addEventListener('DataPageReady', eventHandler); function eventHandler(){ document.querySelector('input[name="cbParamVirtual4"]').addEventListener('change', copyFields); document.querySelector('input[name="cbParamVirtual5"]').addEventListener('change', copyFields); } function copyFields(e){ const element = e.target.name; if(element === "cbParamVirtual4"){ document.querySelector('#cbDSField1').value = e.target.value; } else if (element === "cbParamVirtual5") { document.querySelector('#cbDSField2').value = e.target.value; } } </script> Regards, vitalikssssss
  2. Hi @Elderberg, JS snippet looks correct. Perhaps you have some Triggered action which interfere with updated records. If not, you can share a whole snippet, so we could help you to narrow down the issue. Regards, vitalikssssss
  3. Hi @CraigSZ, Here is a page which has a Chart page dynamically rendered depending on which button was clicked. You would need to have some div element which would serve as a container for updated Datapage. <div id="datapage-container"></div> Here is a code which I have in Datapage. 1. HTML block with buttons: <div class="buttons"><input id="[@field:Name]" type="button" value="Sales in Eastern region"></div> <br> <div class="buttons"><input id="[@field:Name]" type="button" value="Sales in Central region"></div> 2. JavaScript snippet which render Datapage and also pass parameters: <script type="text/javascript"> document.addEventListener('DataPageReady', addEvents); //Add event listeners to buttons function addEvents(){ const buttons = document.querySelectorAll("input[type='button']"); buttons.forEach(element => { element.addEventListener('click', showDp) }); } //Checks which button is clicked and pass different parameters function showDp(e){ if(e.target.value.includes('Eastern')){ createPage('Eastern', e.target.id); } else if (e.target.value.includes('Central')){ createPage('Central', e.target.id); } } //Removes old DataPage if it exist and creates new one function createPage(par1, par2) { const newDataPage = document.createElement('script'); const container = document.querySelector('#datapage-container'); newDataPage.src = `https://xxxxxx.caspio.com/dp/xxxxxxxxxxxxxxxxxxxxxxxx/emb?region=${par1}&name=${par2}`; //Deploy code of new Datapage //Checks if there is a DP rendered already if(container.firstChild){ //Removes datapage if it already exist while(container.firstChild){ container.firstChild.remove(); } //Adds new datapage document.getElementById('datapage-container').appendChild(newDataPage); } else { document.getElementById('datapage-container').appendChild(newDataPage); } } </script> Hope this helps. Regards, vitalikssssss
  4. 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
  5. Hi @Chrille, The issue is caused by the following line of code. You can simple removed it in order to make it work. document.removeEventListener('DataPageReady', drawSignature); Regards, vitalikssssss
  6. Hi @Libby, Triggered Action have 10,000 records limit per run and same applies to Application Tasks. You will not be able to run a Task on table which has 61,000 records https://howto.caspio.com/tables-and-views/triggered-actions/
  7. Hi @aquintanilla, Here is possible way how you can achieve the desired functionality. 1. Add Virtual field to the form and set a default value URL to which user will be re-directed after submit. 2. Add the following snippet in Datapage Header. Make sure you make changes in lines with comment ***Change <script type="text/javascript"> document.addEventListener('DataPageReady', creatBtn); // function creatBtn () { // Hides the Virtual field const link = document.querySelector("#cbParamVirtual1"); //***Change Virtual1 if needed link.style.display = 'none'; //Create a button element const Btn = document.createElement('input'); Btn.type = 'submit'; Btn.name = 'customBtn'; Btn.classList.add('cbSubmitButton'); Btn.value = 'Custom Button'; //***Change the name of the button here Btn.style.background = '#f51212d9'; //***Change color of the button here Btn.addEventListener('click', function() { changeURL(link)}); //Add button next to the default Submit button document.querySelector("div.cbSubmitButtonContainer").appendChild(Btn); } function changeURL(link){ //Changes URL link in Virtual field if the user clicks custom button link.value = 'https://google.com'; //***Change URL here } </script> 3. Set an action to go to New page after record submit and use Virtual field as a parameter: Hope this helps. Regards, vitalikssssss
  8. Hi @ahmedramadan, Perhaps you may try the following code snippet: <script type="text/javascript"> document.addEventListener('DataPageReady', initGeolocation); function initGeolocation() { if(navigator.geolocation) { // Call getCurrentPosition with success navigator.geolocation.getCurrentPosition(success); } else { alert("Sorry, your browser does not support geolocation services."); } } function success(position) { //Change to EditRecord for an update form //Current_Long and Current_Lat should change to reference correct field names document.getElementById("InsertRecordLong").value = position.coords.longitude; document.getElementById("InsertRecordLat").value = position.coords.latitude; document.removeEventListener('DataPageReady', initGeolocation); } </script> Regards, vitalikssssss
  9. Hi @MrRee, I think it is better to raise a ticket for the support department: https://support.caspio.com/ Regards, vitalikssssss
  10. Hi @Elderberg, Yes, it is possible. Here is a topic from Stackoverflow with code sample: https://stackoverflow.com/questions/979975/how-to-get-the-value-from-the-get-parameters Regards, vitalikssssss
  11. Hi @Darnellhood123, You can update any fields with Triggered action. Makes sure you select #inserted if you would like to update same record which was submitted or updated. Regards, vitalikssssss
  12. Hi @HughOD, This method works if you disabled the Responsive feature.
  13. Hi @HughOD, This method works only with Responsive option disabled. If you would like to preserve responsive design of Datapages you may try using the following code in HTML blocks: HTML block #1 </header><div style="display:none;"><header> HTML block #2 </footer></div><footer> Cheers, vitalikssssss
  14. Hi @CraigSZ, You may utilize the concept explained in this post: Hope this helps. Regards, vitalikssssss
  15. Hi @HughOD, I had a similar issue before and it is some kind of limitation of the Free version of Caspio. I have raised a ticket regarding this and Support rep informed me that there was some security check which run behind the scene and affected the loading time. You can raise a ticket here: https://support.caspio.com/ Regards, vitalikssssss
×
×
  • Create New...