Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by carlJS

  1. Hello @Empowering, It might be because your field [@field:Opportunity_Name] contains a literal & value. This usually happens when you submit on a Rich Tex Editor. Try checking your DataSheet if this is the case. If it is, you may need to run the function over to some HTML Entity decoder like this one [link]. You may also try checking this solution. Which, I think, the output will be the same. If it is, then it is likely that my assumption above is true.
  2. Hello @NickO, I must've misunderstood your OP in my previous comment. Now, I assume what you are trying to do is to specify an onload value to an inline edit fields that is a Cascading Dropdown of multiple levels (Cascading Field on a Cascading Field). If my assumption is correct, then that's great. I've been trying to work on a solution for it and it's harder than it seems since Caspio is using a custom DropBox picker. Below is a prototype. It works intermittently. Make sure that the first item in the elements array is the parent field. Also, this codes assume that the Parent Field is a "Dropdown". Again, as mentioned, this is a WIP. <script> var ev_md = new Event("mousedown"); document.addEventListener('DataPageReady', function() { // Add elements in array in format ['FieldName', '[@ParameterName]'], var elements = [ ['cas1', '[@Virtual1]'], ['cas2', '[@Virtual2]'], ['cas3', '[@Virtual3]'], // ['cas4', '[@Virtual4]'], ] // Add elements in array in format ['FieldName', '[@ParameterName]'], elements.reverse(); elements.forEach(function(elem, idx) { var element = document.querySelector(`[id*=InlineAdd${elem[0]}]`); addCasChangeHandler(element, elem[1]); if(idx == elements.length - 1) element.dispatchEvent(new Event("change")); }) }) function addCasChangeHandler(elem, value) { elem.addEventListener('change', function(e) { var t = e.target; console.log(t); t.dispatchEvent(ev_md); var db = document.querySelector(`.DropBox`); var observer = new MutationObserver( function(mutationsList, observer) { mutationsList.forEach( function(mutation, idx){ console.log(mutation); if(mutation.target == db) { console.log("Yes!"); console.log(value); var opt = document.querySelector(`.DropBox .Option[title="${value}"]`); if(opt) opt.click(); else t.dispatchEvent(ev_md); observer.disconnect(); } t.click(); }); }); observer.observe(db, {attributes: true, childList: true, subtree: true}) }) } </script> Hope this helps, in any way. [src="carl.js"]
  3. Hello @NickO, Search (included) and Results uses a different DOM IDs naming convention compared to Submission Form. Cascading Dropdowns usually take a few seconds to load asyncrhronously (depending on your network speed), and before this happens, the script had already ran. The solution to this would be to set a delay before your browser runs this line of code. <script> setTimeout(function() { document.querySelector('[id*=]').value = "[@FeatureID]"; }, 1000) </script> Not entirely certain what your use-case is but I hope this algorithm works. Note: if you are using this on Forms, I recommend putting this in an HTML Block that is positioned at the very bottom (so that the fields are already written to the DOM before the script runs). [src="carl.js"]
  4. Bonus Round !!! If you wish to fill the missing ProblemVertical records, [perhaps if new Verticals were added and you wish to relate this with pre-existing Problems] you may use the Task below. Then run it on demand. [src="carl.js"]
  5. This Triggered Action should relate the #inserted Problem to all of your Verticals in the ProblemVertical table. Note: I used autonumber for the IDs. Export the attached file for live working example Tables_2019-Nov-22_0657.zip
  6. Hello y'all, This solution is great. I have tested it. However, on my use case, I had dropdowns and textareas which were not affected by the reset. I just wanted to share an updated code that will affect such. <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=""; }); } </script> [src="carl.js"]
  7. Hello Mikey, The DataPages deployed on the same pages should automatically be updated with records when an action is done on one of your DataPages. This feature is called AJAX Loading and is enabled by default. You may check on this article for more information: https://howto.caspio.com/datapages/ajax-loading/ Let me know if this is not what you're looking for. [src="carl,js"]
  8. Hello, This also works by using 1/0. I prefer to use this one as Calculated Values in Yes/No fields only accepts these values.
  9. You may check this article for 3rd party apps that offer the scrolling screen capture functionality. Snagit does this. https://www.guidingtech.com/scrolling-screenshots-windows-10/ https://support.techsmith.com/hc/en-us/articles/203731528-Snagit-Windows-Custom-Scroll-in-Snagit-12 Hope this helps [src="carl.js"]
  10. Hello, You may also want to use Calculated Values for this. Below is the syntax I used in one of my workflows. CASE WHEN DATALENGTH('[@field:Cancel_Notification_Date]') > 0 AND [@field:Auction_Status] = 'Cancelled' THEN '[@field:Cancel_Notification_Date]' ELSE CAST( '[@cbTimestamp~]' as DATETIME ) END I hope this helps [src="carl.js"]
  11. Hello, You may also want to check on this thread It shows how to prevent form submissions using Caspio Standard Features. With regards to showing an error message, you may show/hide and HTML Block using rules. Hope this helps. [src="carl.js"]
  12. Hi, I believe you can put a literal line break in Calculated Fields. As shown in the screenshot below, I've tested it and it works. [src="carl.js"]
  13. Hello guys, Try using this line of code. var chart = Highcharts.charts[+document.querySelector('[action*="[@cbAppKey]"] .highcharts-container').id.replace('highcharts-', '')] Works on my end. Hope this works on yours too. [src="carl.js"]
  14. This line of code of yours should work. window.opener.location.href = "url popup window"; Do note that the value is interpreted as a relative path so you may want to specify a scheme/protocol if you want it to be an absolute URL e.g. https://www.mysite.com [src="carl.js"]
  15. Hi @NeoInJS, You may try pasting the code snippet provided in an HTML Block. (Note: Disable the HTML Editor from the Advanced tab, and move the HTML Block to the very bottom). Note that we can add/remove items in the fields array. We can add DataSource fields as well. Just duplicate field lines as needed and put cbParamVirtualn, or the name of your DataSource field. <script> var fields = [ 'cbParamVirtual1', 'cbParamVirtual2', 'cbParamVirtual3', 'cbParamVirtual4', ]; /* * * Do not modify code from beyond this point */ fields = fields.map( function(elem) { return document.querySelector('[action*="[@cbAppKey]"] [id*='+ elem + ']'); }); function changer(ev) { fields.forEach(function(field) { if (ev.target.value != '' && ev.target != field) field.value = ''; }); } fields.forEach(function(fff) { fff.addEventListener('change', changer); }); </script> [src="carl.js"]
  16. Hi @TroubleShooter, You may use the syntax below on a Calculated Value to get the First Sunday of the Month. Virtual 1 represents numeric month Virtual 2 represents numeric year DATEADD ( day, (( 8 - DATEPART(weekday, CAST('[@cbParamVirtual1]/1/[@cbParamVirtual3]' as DATE) )) % 7 ), CAST('[@cbParamVirtual1]/1/[@cbParamVirtual3]' as DATE) )
  • Create New...