Jump to content

Andrii

Members
  • Content Count

    24
  • Joined

  • Last visited

About Andrii

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @MayMusic If you want to hide just Edit button and leave the details button, use this code: <script type="text/javascript"> document.addEventListener('DataPageReady', function () { var values = document.getElementsByClassName("your_class_name"); var editButtons = document.getElementsByClassName("cbResultSetActionsLinks"); var firstButton = 2; var secondButton = 3; for (i = 0; i < values.length; i++) { if(values[i].innerHTML == your_condition) { editButtons[firstButton].style.display = "none"; editButtons[secondButton].style.display = "none"; } firstButton += 4; secondButton += 4; } }); </script> It is also adjustable if you have delete button: <script type="text/javascript"> document.addEventListener('DataPageReady', function () { var values = document.getElementsByClassName("your_class_name"); var editButtons = document.getElementsByClassName("cbResultSetActionsLinks"); var firstButton = 2; var secondButton = 3; for (i = 0; i < values.length; i++) { if(values[i].innerHTML == your_condition) { editButtons[firstButton].style.display = "none"; editButtons[secondButton].style.display = "none"; } firstButton += 6; secondButton += 6; } }); </script>
  2. Hello Alison, I will add the application to let you play with it. You can implement this functionality using JavaScript. First of all, you need to copy a value of a needed field in the HTML block adjust it as the <p> HTML element with class and hide it. To copy the value use the parameters feature. Then you need to insert the following code in the footer: <script type="text/javascript"> document.addEventListener('DataPageReady', function () { var vals = document.getElementsByClassName("your_class_name"); var buttons = document.getElementsByClassName("cbResultSetActionCell"); for (var i=0; i < vals.length; i++){ if (vals[i].innerHTML == your_value){ buttons[i].style.display = "none"; } } }); </script> You need to copy the class value of your <p> element in the "your_class_name" part and adjust the value of "your_value" part according to your conditions. CaspioData_2018-Dec-05_1425 (1).zip
  3. You can try to build this trigger not using IF-ELSE blocks but using WHERE block. In this case, you can specify your condition in WHERE block like you do in IF part. Also, it is very helpful to use JOINs to get the proper result sets and make aggregations with them. You can check this article to get familiar wi this function: https://www.w3schools.com/sql/sql_join.asp https://www.w3schools.com/sql/sql_join_inner.asp https://www.w3schools.com/sql/sql_join_left.asp https://www.w3schools.com/sql/sql_join_right.asp https://www.w3schools.com/sql/sql_join_full.asp
  4. Try to use Expressions to sum your fields. Fiend the print screens attached.
  5. Hello! You need to use COUNT() instead of SUM() to count the number of fields you insert into the table. Find the print screen attached.
  6. Andrii

    Event registration

    Hello. Follow these steps to implement such a workflow: 1. You need to add 2 Calculated values in your Submission form to retrieve the possible amount of users for the Event and actual amount of users at the time. Here is the example of the code: -- possible amount SELECT Amount_of_people FROM Events WHERE Id = [@field:Event_ID] -- actual amount SELECT COUNT(User_Name) FROM Register_table WHERE Event_ID = TARGET.[@field:Event_ID] You can make these Calculated fields as hidden if you wrap them into two HTML blocks and insert code: <table style="display: none;"> </table> 2. Add Header/Footer and insert this snippet of code: <script type="text/javascript"> document.addEventListener('DataPageReady', function () { var availableAmount; var currentAmount; var timer = setInterval(function(){ availableAmount = document.querySelector("span[id^='cbParamVirtual1']").innerHTML; currentAmount = document.querySelector("span[id^='cbParamVirtual2']").innerHTML; if (availableAmount == currentAmount) { document.querySelector("input[value='Submit']").style.display = "none"; document.getElementById("status").innerHTML = "There is no available places"; clearInterval(timer); } else if (availableAmount > currentAmount) { clearInterval(timer); } }, 1000); }); </script> This code will check if the number of attendees are equal or not and will hide the Submit button if needed. You also need to adjust the SQL and JS code according to your element names. Please find the application attached to play around with it. Also, take a look at the Tables and Relationship between them. NOTE! This APP will work only when the value of Event is already sent as the parameter on load. JS_Display_Of_Submission_Based_on_Attendees_Amount.zip
  7. Andrii

    Share Parameter outside Embed

    Hello. You can create either an HTML block or Header/Footer and write the HTML tags with your parameters. Example: <p id="a1" style="display: none;">[@your_parameter_1]</p> <p id="a2" style="display: none;">[@your_parameter_2]</p> . . . <p id="an" style="display: none;">[@your_parameter_n]</p> After that, you can use JavaScript to call the values of your parameters and use them on your page. You can call the Element like this: document.getElementById("id_value").innerHTML() This code will give you the content in the <p> tag.
  8. Hello! Can you provide me with more details regarding your workflow? You can write me in Privat. I need some more information about your first trigger and how do you insert a few rows into the Details table.
  9. Hello. You can implement such a workflow using JavaScript. First of all, you need to add one HTML block to define the statuses. Here is the example of the HTML block: 1. Open Status. You can also insert the link of your registration form in the "href" property. 2. Closed Status. 3. Field to copy the date of the expiration. Use the parameter picker to insert the date value. Use the "Short date" format. Then you need to add header/footer and insert this snippet of code in the footer: <script type="text/javascript"> var elemOpen = document.getElementsByClassName('Open'); var elemClose = document.getElementsByClassName('Close'); var elemDate = document.getElementsByClassName('Date'); document.addEventListener('DataPageReady', function () { for(var i = 0; i < elemDate.length; i++) { var dateArr = elemDate[i].innerHTML.split("/"); var date = new Date(dateArr[2] + "-" + dateArr[1] + "-" + dateArr[0]).getTime(); var milSecDay = 86400000; var currentDate = Date.now(); var differDay = (date - currentDate) / milSecDay; if(differDay > 4) { elemOpen[i].style.display = ""; } if(differDay < 4) { elemClose[i].style.display = ""; } } }); </script> If you want, you can import my application and play around with the datapage to get familiar with this idea. Find the application attached. JS_Change_Status_based_on_Date.zip
  10. Andrii

    Changing displayed width of form element display only

    Hello! You can use additional CSS code to adjust the width of your fields. To inspect the HTML code of the page and find the Class name of a needed field you can use the Developer Tools of a browser. Find the print screens attached:
  11. Andrii

    Display WebPage Name on the Report

    Hello! You can create one additional table with the unique ID names of sites (Facebook, Twitter, Instagram) and with the actual links. Then you may adjust the relationship between this table and your report table. Create the relationship between actual link field and field that contains the links in your report table. Adjust the relationship to be displayed on datapages. Here is the article regarding the Relationship between the tables: https://howto.caspio.com/tables-and-views/relationships/ Find the print screens to implement such a workflow:
  12. Hello! Since Caspio implemented the AJAX functionality you can implement such a workflow if you have your submission form and report page deployed in the same web page.
  13. Try to use such a statement as the example: CASE WHEN [@field:date_test] < CONVERT(datetime, '09/09/9999', 101) AND IsNull([@field:Num_test], 0) = 0 THEN Datediff(year ,[@field:date_test], CONVERT(datetime, '09/09/9999', 101)) END You can adjust it for your need and add as much Case conditions as you need. You may find the standard statements you can use in formula fields. If you highlight these statement, you will find the description of the statement. Also, check these articles to get familiar with the CASE and CONVERT statements: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql?view=sql-server-2017 https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-2017
  14. @edujobs2k18 To implement your workflow you can use this code: <script type="text/javascript">function addTimestamp (fileInputId, timestampInputId, textInptId) { var fileInput = document.getElementById(fileInputId); fileInput.addEventListener('change', function () { if (fileInput.files.length !== 0 ){ document.getElementById(timestampInputId).value = '[@cbTimestamp*]'; document.getElementById(textInptId).value = 'New'; } }); }; addTimestamp('fileInputId1', 'timestampInputId1', 'textInptId1'); addTimestamp('fileInputId2', 'timestampInputId2', 'textInptId2'); addTimestamp('fileInputId3', 'timestampInputId3', 'textInptId3'); . . . addTimestamp('fileInputId_x', 'timestampInputId_x', 'textInptId_x'); </script> Just find the IDs of the text fields using Developer Tools of the browser and insert these values instead of 'textInputId1', 'textInputId2'.....'textInputId_x'.
  15. To implement such a workflow you need to add Header/Footer and insert this little snippet of code into the footer. Note that "HTML Editor" needs to be disabled. <script> document.getElementById('cbParamVirtual1').addEventListener("change", function() { if (document.getElementById('cbParamVirtual1').value == 'Choice_1') { document.getElementById('cbParamVirtual20').checked = true; } else if (document.getElementById('cbParamVirtual1').value == 'Choice_2' || document.getElementById('cbParamVirtual1').value == 'Choice_3') { document.getElementById('cbParamVirtual21').checked= true; } else { document.getElementById('cbParamVirtual20').checked = false; document.getElementById('cbParamVirtual21').checked = false; } }); </script> You need to choose your own ID values of elements using Developer tools of a browser. Also, you need to adjust the values of Dropdown in the code according to your adjustments in the Dropdown. This code can be adjusted depending on the amount of the choices if the Dropdown and CheckBox. <script> document.getElementById('cbParamVirtual1').addEventListener("change", function() { if (document.getElementById('cbParamVirtual1').value == 'Choice_1') { document.getElementById('cbParamVirtual20').checked = true; } else if (document.getElementById('cbParamVirtual1').value == 'Choice_2' || document.getElementById('cbParamVirtual1').value == 'Choice_3') { document.getElementById('cbParamVirtual21').checked= true; } else if (document.getElementById('cbParamVirtual3').value == 'Choice_3' || ... || document.getElementById('cbParamVirtualX').value == 'Choice_X') { document.getElementById('cbParamVirtualX').checked= true; } else { document.getElementById('cbParamVirtual20').checked = false; document.getElementById('cbParamVirtual21').checked = false; . . . document.getElementById('cbParamVirtual2X').checked = false; } }); </script>
×