-
Posts
142 -
Joined
-
Last visited
-
Days Won
17
Hastur last won the day on August 29
Hastur had the most liked content!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Hastur's Achievements
-
ivan77 reacted to a post in a topic: Auto format a phone number field javascript
-
roattw reacted to an answer to a question: Not justifying certain rows or cells in DP
-
researched reacted to a post in a topic: Disable Submit button
-
researched reacted to a post in a topic: Disable Submit button
-
vidierre reacted to an answer to a question: Show/Hide Fields Based on Drop Down Selection
-
ChristianM reacted to an answer to a question: Display total records in Pie Chart
-
Alison reacted to a post in a topic: Change color of the column in chart
-
Change color of the column in chart
Hastur replied to Alison's topic in User JavaScript and CSS Discussions
Hello! To change the color you need to use additional JS code. It will parse the data in chart and change the color according to name of the column. Here is the code: <script type="text/javascript"> document.addEventListener('DataPageReady', chartUpdateHandler); function chartUpdateHandler(event) { var cleaner = function(interv) { clearInterval(interv); } let interv = setInterval(() => { if (!!Highcharts) { const options = Highcharts.charts[0].series[0].data; let data = []; options.forEach(option => { let localData = {}; localData.y = option.y; localData.name = option.name; if(option.name === "(blank)") { localData.color = '#ee5921'; } else { localData.color = '#3186AD'; } data.push(localData); }) Highcharts.charts[0].update({ series: { data: data } }); cleaner(interv); } }, 200); } </script> You need to insert this code into the Header of the report DataPage. Do not forget to disable the HTML editor. -
mhand reacted to an answer to a question: Create a record in a different table from a datapage
-
Vitalikssssss reacted to a post in a topic: How to get the file size
-
How to get the file size
Hastur replied to CoopperBackpack's topic in User JavaScript and CSS Discussions
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. -
Auto-submit a Form to Track User Page Views
Hastur replied to davidhshugar's question in General Questions
@davidhshugar I have improved the solution to work without reloading. You need to add one additional HTML block with this code: <p id="ancor"></p> The following code should be int the Header: <script type="text/javascript"> document.addEventListener('DataPageReady', submitHandler); function submitHandler() { let submissionForm = document.querySelector('form[action^="your_deploy_URL"]'); submissionForm.style.display = 'none'; if(document.getElementById('ancor') !== null) { document.removeEventListener('DataPageReady', submitHandler); submissionForm.submit(); } document.removeEventListener('DataPageReady', submitHandler); } </script> To make it work, DataPage itself should either redirect OR show the message after the submission. -
iFrame scrolling options
Hastur replied to CoopperBackpack's topic in User JavaScript and CSS Discussions
Hello @CoopperBackpack You need to use some additional JS to handle the scroll This code needs to be inserted in the Header of the DataPage you open through the link: <script type="text/javascript"> document.addEventListener('DataPageReady', scrollHandler) function scrollHandler(event) { parent.postMessage('scrollHandler', '*'); document.removeEventListener('DataPageReady', scrollHandler) }; </script> This code needs to be placed in your CMS system before the deploy code of the DataPage: <script> window.addEventListener("message", receiveMessage, false); function receiveMessage(event){ if (event.data === 'scrollHandler') { window.scroll(0, 0); } } </script> -
Hello @CoopperBackpack You can insert this snippet of code into your submission form Header: <style> .cbFormFieldCell { position: relative; width: 50%; } .cbFormFieldCell .floating-label { position: absolute; color: gray; font-size: 13px; pointer-events: none; top: 11px; left: 20px; transition: 0.2s ease all; } .cbFormFieldCell input:focus ~ .floating-label, .cbFormFieldCell input:not(:focus):valid ~ .floating-label { top: 0px; left: 10px; font-size: 10px; opacity: 1; background-color: white; padding: 0 3px; } </style> <script> document.addEventListener("DataPageReady", placeholderHandler); function placeholderHandler() { const labels = document.querySelectorAll('.cbFormLabelCell'); const inputs = document.querySelectorAll('.cbFormFieldCell'); for(let i = 0; i < labels.length; i++) { if (inputs[i].children[0].type === 'text') { labels[i].children[0].classList.add("floating-label"); inputs[i].children[0].setAttribute("required", true); inputs[i].appendChild(labels[i].children[0]); labels[i].remove(); } } console.log(labels); } </script> You also can customize the placeholder adjusting the properties in the style tag of the code.
-
@GPJ11 Can you specify the DataPage element type and the Data Type of the field you use? You may send the print screens. It is critical to create the script
-
@benrob You an try the following: 1. Place this code outside of the iFrame deployment above the deploy code: <script type="text/javascript"> window.addEventListener("message", receiveMessage, false); function receiveMessage(event) { document.querySelector('iframe[name="Search and Report"]').height = event.data } </script> 2. Insert this code into the Result set of the Report: Header: </header> <div id="wrapper"> <header> Footer: </footer> </div> <footer> <script type="text/javascript"> document.addEventListener('DataPageReady', resizeHandler) function resizeHandler(event) { let heightVal = document.getElementById('wrapper').offsetHeight + 150; parent.postMessage(heightVal, '*'); document.removeEventListener('DataPageReady', resizeHandler) }; </script> Do not forget to use the name of your DataPage instead of "Search and Report"
-
Alert Box For When Specific Value is Chosen
Hastur replied to kpcollier's topic in User JavaScript and CSS Discussions
Hello @kpcollier You can use this code: <script type="text/javascript"> document.addEventListener('DataPageReady', assignAdditionalListeners) function assignAdditionalListeners() { document.querySelector('input[id^="InsertRecordtext_f0"]').addEventListener('change', customAlert); // change ID document.querySelector('input[id^="InsertRecordtext_f1"]').addEventListener('change', customAlert); // change ID document.querySelector('input[id^="InsertRecordtext_f2"]').addEventListener('change', customAlert); // change ID document.querySelector('input[id^="InsertRecordtext_f3"]').addEventListener('change', customAlert); // change ID document.querySelector('input[id^="InsertRecordtext_f4"]').addEventListener('change', customAlert); // change ID document.querySelector('input[id^="InsertRecordtext_f5"]').addEventListener('change', customAlert); // change ID document.removeEventListener('DataPageReady', assignAdditionalListeners) } function customAlert(event) { alert(event.target.value); } </script> You need to place the code in the header of the form. Do not forget to disable the HTML editor in the advanced section of the footer. You need to change the ID according to the name of the field you use. In the Example I have name as "InsertRecordtext_f0". If your field has name "Reason", you should name ID like this - "InsertRecordReason0". -
@benrob You may use this code in the Result set of the Report: 1. Header - </header> <div id="wrapper"> <header> 2. Footer - </footer> </div> <footer> <script type="text/javascript"> document.addEventListener('DataPageReady', resizeHandler) function resizeHandler(event) { let heightVal = document.getElementById('wrapper').offsetHeight + 150; // Change 150 according to the height of the search form var localWindow = window.parent.document.querySelector('iframe[name="Search and Report"]').style; // Change the name of the DataPage localWindow.height = heightVal + 'px'; document.removeEventListener('DataPageReady', resizeHandler) }; </script> If you still see scroll, change the 150 value as mention in the code. Also, you need to use the name of your DataPage instead of "Search and Report"
-
Display aggregate of total time as HH:MM
Hastur replied to guardmetrics's question in Calculations and aggregations
@guardmetrics You may use this formula: CAST((( DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) - (DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) % 60) ) / 60) AS nvarchar) + ':' + CASE WHEN LEN(CAST((DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) % 60) AS nvarchar)) = 1 THEN '0' + CAST((DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) % 60) AS nvarchar) ELSE CAST((DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) % 60) AS nvarchar) END- 4 replies
-
- aggregate
- totals aggregation groups
- (and 6 more)
-
Format of TimeStamp Date Changes After Exporting (mm/dd/yyyy to m/d/yyy)
Hastur replied to crionsynx's question in Import/Export and DataHub
Hello @crionsynx You may use additional formula field to get needed layout. Here is the example: CONVERT(nvarchar, [@field:asdwasd], 101) + ' ' + CONVERT(nvarchar, [@field:asdwasd], 108) -
Hello @Jaymee Try to insert this code in the header of the DataPage result set <script type="text/javascript"> document.addEventListener('DataPageReady', hideBlankHandler) function hideBlankHandler() { let labels = document.querySelectorAll('.cbResultSetListViewDataLabel '); let values = document.querySelectorAll('.cbResultSetData'); console.log(labels , values) for (let i = 0; i < values.length; i++) { if (values[i].innerHTML === " ") { labels[i].remove(); values[i].remove(); } } } </script> You need to check two thing. First - your DataPage has the Responsive option enabled Second - you need to disable the HTML editor of the Header
-
Hello @KevinCeres You can achieve this using standard features. You can add the Virtual field to your form with 2 option: stay at form after submission or go next. The values of these radio buttons should be links. Based on the choice, your user will be redirected to the same page (reload) or to a new one. Check the print screens:
-
Display aggregate of total time as HH:MM
Hastur replied to guardmetrics's question in Calculations and aggregations
@guardmetrics The calculated field should look like this in: CAST((( DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) - (DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) % 60) ) / 60) AS nvarchar) + ':' + CAST((DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]) % 60) AS nvarchar) Also you may find other examples here -- 4 replies
-
- aggregate
- totals aggregation groups
- (and 6 more)