Jump to content

Search the Community

Showing results for tags 'javascript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • General Questions
    • Caspio JavaScript Solutions
    • Tables, Views and Relationships
    • Import/Export and DataHub
    • DataPages
    • Deployment
    • Security, Authentications, Roles, SAML
    • Styles and Localizations
    • Parameters
    • API and Integration
    • Calculations and aggregations
    • User JavaScript and CSS Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location


Interests

Found 193 results

  1. Hello, I have some js in the Destination part of a submission form, for after the Submit happens (I do this in js because there are 3 different sets of options to go to after submission, depending on what the user selected in the submission fields). I'm using window.location instead of window.open because of popup restrictions. I need to do 2 things on form submission: 1) have the existing window go to a url with parameters like a normal Caspio form can do and 2) open a different url in a new tab. So basically, the user clicks Submit, the existing window refreshes to a new page and a new tab opens to a different url. Is this possible? Something like: window.location.href = '[@field:First_URL]'; window.location.href = '[@field:Second_URL]', '_blank'; I don't know how to get it to run the code for the 2nd url before it updates to the first, as well as get the 2nd url to open a new tab.
  2. I have a details page I need to make calculations for multiple fields to do estimating. I am entering values in fields and need to create a cost on the form. I was successful in creating some of the calculations but after the 4th calculation is made, the rest of the fields to be calculated display NaN. Here is the script and attached is a screen shot of the results.... <button style="background:red" onclick="calculate()">Calculate</button> <SCRIPT LANGUAGE="JavaScript"> function calculate() { var a = [@field:Area1_Sq_Ft] document.getElementById("EditRecordArea1_Sq_Ft_Cost").value = a*7; var b = [@field:Area1_Vertical] document.getElementById("EditRecordArea1_Vertical_Cost").value = b*7; var c = [@field:Area1_Steps] document.getElementById("EditRecordArea1_Steps_Cost").value = c*7; var d = [@field:Area1_Cracks] document.getElementById("EditRecordArea1_Cracks_Cost").value = d*7; var e = [@field:Area1_Pitting] document.getElementById("EditRecordArea1_Pitting_Cost").value = e*7; var f = [@field:Area1_Removal] document.getElementById("EditRecordArea1_Removal_Cost").value = f*40; var g = [@field:Area2_Sq_Ft] document.getElementById("EditRecordArea2_Sq_Ft_Cost").value = g*7; var h = [@field:Area2_Vertical] document.getElementById("EditRecordArea2_Vertical_Cost").value = h*7; var i = [@field:Area2_Steps] document.getElementById("EditRecordArea2_Steps_Cost").value = i*7; var j = [@field:Area2_Cracks] document.getElementById("EditRecordArea2_Cracks_Cost").value = j*7; var k = [@field:Area2_Pitting] document.getElementById("EditRecordArea2_Pitting_Cost").value = k*7; var l = [@field:Area2_Removal] document.getElementById("EditRecordArea2_Removal_Cost").value = l*40; } </SCRIPT>
  3. Hi, I have a submission form with an image field. I need to be able to use js to bypass the user having to use the Browse button to pull the image path for the image to be submitted (so I can streamline a process of uploading images- I've got a field with the image path mapped to Downloads folder and have a Virtual field using it as a data source. I just need to put that path in the image field so the user doesn't have to Browse to it). I set up test code using a button to trigger the js function so I could see if it was putting the image path (Virtual 1) into the image field for submission (ItemPic). When I run the code using the button I get an error message on the submission form: "Values cannot be submitted due to a data restriction." Does anyone know how to bypass that restriction, in the function I have below? <div style="text-align: center;"> <input class= "cb_custom_btn" type="button" onclick="myFunction()" value="Copy PicPath" /> <script> function myFunction(){ var picpath = document.getElementById("cbParamVirtual1").value; document.getElementById("InsertRecordItemPic").value = picpath; } </script> </div>
  4. I have an odd problem trying to work around the lack of "Distinct" query functionality within Caspio. My data has many to many joins and therefore the view lists a specific field multiple times. When I query to reach a list of these fields, there are obviously multiple rows. I am trying to eliminate those multiple rows and list a single row for each unique value in that field only. The problem is that the datapage is still formatted as if all the results are present. So I get multiple pages with only a single entry on each. While I can change the view to include more records per page, that does not actually solve the problem. I would like to be able to prevent the pagination or actually remove the extra rows from the result set instead of just hiding them. Any ideas?
  5. Hello, I've been working with Caspio for a while now (Although I haven't done any real coding before), and I'm having trouble getting the coding right for something in a tabular report. I have a report with roughly twenty fields and thousands of records. I have a yes/no field that determines whether records have been reviewed by an employee (they toggle it themselves). I'm attempting to set it up to color code the records or even specific fields for that to make it easier to see if things have been dealt with or not. This is the link I found that seemed to have what I needed. I don't have any experience with Javascript so if I'm making an obvious mistake I'm unaware of it. https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-dynamically-change-the-background-of-a-results-page/?_ga=2.268956409.901822134.1565024539-1632853601.1563754793 This is the code I've set up in an alternate HTML block based on the guide. We have an autonumber field 'Encounter_ID' and a yes/no for 'Needs_Review' [@field:Needs_Review^] <a id="visi[@field:Encounter_ID]"> <script> var isi = document.getElementById("visi[@field:Encounter_ID]"); if('[@field:Needs_Review]' == 'Yes'){ isi.parentNode.parentNode.style.backgroundColor = '#FF9999'; } else{ isi.parentNode.parentNode.style.backgroundColor = '#AAFAFA'; } </script> My issue is that when I input the code, it shows the entirety of it typed out without making any changes to the color. If anyone could explain what I'm doing wrong, or suggest an alternative way to accomplish this, please let me know. I would greatly appreciate it. Thanks in advance! - Ryan
  6. So I'm trying to get the value that is already in the current points field, do a calculation as depicted in the switch statement and then fill the field in again with the new number before submitting instantly. This is all supposed to be done as a way of replacing an SQL update statement. For some reason my EditRecord or document.getElementById doesn't seem to be working at all. <script LANGUAGE="Javascript"> function calculate(){ var pos = [@pos]; var points = [@field:CurrentPoints#]; switch(pos) { case 1: points += 10; break; case 2: points += 8; break; case 3: points += 6; break; case 4: points += 4; break; case -2: points += -2; break; default: points += 2; } document.getElementById("EditRecordCurrentPoints").innerHTML = points; } document.getElementById("mypage").onsubmit=calculate(); </script> There is already a <div id="mypage"> in the header and a </div> in the footer. Am I just being very stupid?
  7. I am using a submission form and trying to customize it. It's a simple script that displays a warning message and stops submission, if a user makes a certain combination of selections(i.e. selects ABC from a dropdown and XYZ is calculated in the Virtual field. However, the code does not seem to work. Could somebody take a look and let me know what I am doing wrong? The UseCaseType is a dropdown with a lookup table linked to it, and the Virtual Parameter is a Calculated Value SQL script(that does work). For some reason, a and b are populated as nulls. <script> document.addEventListener('BeforeFormSubmit', function (event) { var a = document.getElementById("InsertRecordUseCaseType").value; var b = document.getElementById("cbParamVirtual2").value; alert('a is ' + a + ' | b is ' + b); if (a == 'ABC' && b == 'XYZ') { alert('You cannot select ABC and XYZ together'); event.preventDefault(); } }); </script>
  8. I want to create a JS if statement that updates a fields value based on another fields value. If the field Virtual2 does not equal "Don't Share" I want the field CON_1 to equal Virtual2 Here is what I used unsuccessfully in the footer of a details page in a tabular report data page... <SCRIPT LANGUAGE="JavaScript"> function con1() { var v2 = parseFloat(document.getElementById("InsertRecordVirtual2").value); if(v2="Don't Share") {} else {document.getElementById("InsertRecordCON_1").value = (v2);} } document.getElementById("caspioform").onsubmit=con1; </SCRIPT> CON_1 is a text data type and Virtual2 is a virtual field drop down that on default = "Don't Share" Thanks Guys! Any help would be greatly appreciated!
  9. Hello! I am using a javascript code to change the values of some text fields everytime the user choose a value on a dropdown list at a submission form. This is the code: <SCRIPT LANGUAGE="JavaScript"> function atualizacampos() { var text1 = document.getElementById('InsertRecordEntidades_Canais_Info_1'); var text2 = document.getElementById('InsertRecordEntidades_Canais_Info_2'); var text3 = document.getElementById('InsertRecordEntidades_Canais_Info_3'); var text4 = document.getElementById('InsertRecordEntidades_Canais_Info_4'); var dropC = document.getElementById('InsertRecordEntidades_Canais_ID_Canal_Doacao'); var Cselecionado = dropC.options[dropC.selectedIndex].text; switch(Cselecionado) { case 'Depósito Bancário': text1.value='Agência' break; case 'Nota Fiscal': text1.value='Número da Nota'; break; case 'Paypal': text1.value='Código Paypal'; break; default: } } document.getElementById('InsertRecordEntidades_Canais_ID_Canal_Doacao').onchange=atualizacampos; </SCRIPT> This is already working, but right now i am trying to change also the labels of those text fields. I already tried some sibblings options, but it did not work. Can you guys please tell me the correct code to achieve that? So everytime a user change the dropdown value, the text1.value will be changed and also the label associated with this field will be changed for a new value. Can someone please help? My best regards, Shidartha
  10. Are there any independent contractors out there that are familiar with Caspio and interested in doing some work utilizing Java script? Some minor enhancements needed with our Caspio form that requires JS code injected. Thanks!
  11. Hi there, How can I create a chart using just values from table fields but not the count/sum functions? My result set is 1 row and I want to show values on a chart. If value is blank - I don't want to show it on the chart. Any help will be appreciated. Regards, vitalikssssss
  12. Hello, I have been using the following code in the footer of a details data page. It previously worked to concatenate an autocompleted value from a virtual field with a text area field called "associatedSpecies." This is based on the javascript solution from Caspio below, but I'm not sure if this is no longer supported by more recent browsers? Does anyone have any insight on how I might make this work again? <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var x0 = document.getElementsByName("EditRecordassociatedSpecies")[0].value; var x1 = document.getElementsByName("cbParamVirtual2")[0].value; if (x0 && x1) { document.getElementsByName("EditRecordassociatedSpecies")[0].value = x0+"; "+x1; } else { document.getElementsByName("EditRecordassociatedSpecies")[0].value = x0 + x1; } } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT>
  13. I am creating an application where I log daily events so I can view them in a DataPage report. I would like to be able to copy a record if I repeat an event, instead of re-entering the data in a web form. I was told I would have to create a hidden DataPage that auto submits the data, that will require some use of JavaScript. How do I create a hidden DataPage that auto submits data with JavaScript?
  14. Hi I am stuck with javascript doing multiple calculations in same datapage. 1st javascript is calculation of unit cost, no of units and total (in local currency) 2nd javascript is convert local unit cost to USD based on cascading dropdown field 3rd javascript is using unit cost (in USD), no of units to derive total cost (in USD) the 1st javascript seems to be working. But when I add on 2nd javascript, only one value shows and in the wrong field. There is also no error appearing in the web console. Eg javascript 1 calculation = virtual field 1 = virtual field 1 value javascript 2 calculation = virtual field 2 = virtual field 2 value Instead what i see is this javascript 1 = virtual field 1 = virtual field 2 value javascript 2 = virtual field 2 = blank I followed basically this script and did my own modification http://forums.caspio.com/index.php?/topic/6053-perform-calculations-in-submission-form/ I think the problem is I did not define 2 variable that points to virtual field 1 and virtual field 2 respectively. var totalField = document.getElementsByClassName('cbFormData')[0]; I need 2 of it, and I do not how to define for the 2nd virtual field. Also, how do I pass the the virtual field to a table field? I used the Pass field value as parameter, it does not seem to write into the table. Can anyone please help? <script type="text/javascript"> // Caspio form elements to calculate local total cost var unitcostField = document.getElementById('InsertRecordLocalUnitCost'); var unitsField = document.getElementById('InsertRecordUnit'); // var totalField = document.getElementById("cbParamVirtual1"); ** I tried using this to point to virtual field but it did not work ** var totalField = document.getElementsByClassName('cbFormData')[0]; // Caspio form elements to convert local to USD cost var exchangerateField = document.getElementsByName("InsertRecordExchangeRate")[0]; //var convertField = document.getElementById("cbParamVirtual2"); ** I tried using this to point to virtual field but it did not work ** var convertField = document.getElementsByClassName('cbFormData')[0]; var caspioForm = document.getElementById('caspioform'); // Event handler var calculateTotal = function (event) { // TODO: Do something on value change --> totalField.innerHTML = unitcostField.value * unitsField.value; } var calculateExchangeRate = function (event) { // TODO: Do something on value change --> convertField.innerHTML = (1/exchangerateField.value) * unitcostField.value; } // Run total calculation on input to any of these two fields unitcostField.addEventListener('input', calculateTotal); unitsField.addEventListener('input', calculateTotal); unitsField.addEventListener('input', calculateExchangeRate); unitcostField.addEventListener('input', calculateExchangeRate); </script> Thanks in Advance
  15. Hi, I have a simply one that I just can not figure out. I know it's easy but I haven't been able to get this to work. I have a field where the user will enter a date. I want to take that date and add one, then insert into another field on a submission form. Field Name: End Date (user entered) = 10/23/2017 Field Name: Expire Date (calculated) = 10/24/2017 Any help would be appreciated.
  16. Want to display a different header according to value of field from user authentication. Code logic works fine, but the HTML I want to be executed does not work. Here's a sample script. The Italics part after the "if" statement works well on its own, but with the conditional code, it is ignored. Rules can't be used (I think) as they do not operate with Header or Footer blocks in a Data Page. <script> if("[@authfield:User_Company_Name]" == "ABC Ltd"){ Welcome [@authfield:User_Name] to your account &nbsp; <a href="https://www.myurl1/" target="_blank"><img alt="" src="https://myurl2.png" style="width: 50px; height: 10px; vertical-align: middle;" /></a>&nbsp;<a href="https://Myaccount.caspio.com/folderlogout">Logout</a> } Else{ Display an alternative header } </script> Many thanks for any help/advice you may be able to give!
  17. Hello, I have a Details datapage set up so when Update is clicked it goes to the next record. I need to figure out how to create a custom button (to put in either the Footer or an HTML block) to go to the Next Record (and a button for Previous, as well) so that the user can cycle through without clicking Update. The standard record navigation arrows at the bottom will not work for UI reasons (I need to make the custom 'Next Record' button relabeled and hidden in various scenarios). Does anyone know how to create a custom button for Next Record? As well, I also need to know how to hide that button (if it's in its own Section in an HTML block) when the Details form is at the 'last record' of the series (because there will be no 'Next Record' at that point). Any help would be greatly appreciated-
  18. In a table i have 12 columns like "Proof_for_Placement(File Filed)", "Document_Remarks_Placement(Text Field)", "Document_Upload_Date(Date Field)" etc. So i have created a coding if users upload a file in "Proof_For_Placement" the automatically "New" status will be taken in "Document_Remarks_Placement" filed and Timestamp will be captured in "Document_Upload_Date" filed. <script type="text/javascript"> function addTimestamp (fileInputId, timestampInputId) { var fileInput = document.getElementById(fileInputId); fileInput.addEventListener('change', function () { if (fileInput.files.length !== 0 ){ document.getElementById(timestampInputId).value = '[@cbTimestamp*]'; } }); }; function addDocStatus (fileInputId, docstatusId) { var fileInput = document.getElementById(fileInputId); fileInput.addEventListener('change', function () { if (fileInput.files.length !== 0 ){ document.getElementById(docstatusId).value = 'New'; } }); }; addDocStatus('EditRecordProof_For_Placement', 'EditRecordDocument_Remarks_Placement'); addTimestamp('EditRecordProof_For_Placement', 'EditRecordDocument_Upload_Date'); addDocStatus('EditRecordWorking_Proof_1st_Month', 'EditRecordDocument_Remarks_1st_Payslip'); addTimestamp('EditRecordWorking_Proof_1st_Month', 'EditRecordWorking_Proof_Submitting_Date'); addDocStatus('EditRecordWorking_proof_2nd_month', 'EditRecordDocument_Remarks_2ndPayslip'); addTimestamp('EditRecordWorking_proof_2nd_month', 'EditRecordWorking_proof_Submitting_Date_2'); addDocStatus('EditRecordWorking_proof_3rd_month', 'EditRecordDocument_Remarks_3rdPayslip'); addTimestamp('EditRecordWorking_proof_3rd_month', 'EditRecordWorking_proof_Submitting_Date_3'); </script> Now i want a different code for different process. Like if someone checked the documents or file in "proof_for_placement" and changed the status of "Document_Remarks_Placement" manually then "Document_Upload_Date" will be taken as the timestamp. Since i have zero coding language, i am not able to build the code.
  19. I've been trying to add a month to a date for the use of recurring payments. The code I have to put in the HTML block I have placed below. And thats a code i got from someone else on this website but it doesn't not work. Please help. [@field:New_Date*] <SCRIPT LANGUAGE="JavaScript"> function setDate() { var New_Date = "first"; var Current_Date_1 = "second"; New_Date = "InsertRecord" + New_Date; Current_Date_1 = "InsertRecord" + Current_Date_1; var New_Date = document.getElementById(New_Date ).value; var New_Date = new Date(Date.parse(New_Date)); var result_Date = new Date (first_Date.setMonth(first_Date.getMonth()+1)); var d_month = result_Date.getMonth() + 1; if (d_month<10) {d_month = "0" + d_month;} var d_day = result_Date.getDate(); if (d_day<10) {d_day = "0" + d_day;} var d_year = result_Date.getFullYear(); var str_date = d_month + "/" + d_day + "/" + d_year; document.getElementById(Current_Date_1[@field:Current_Date_1*] ).value = str_date; } document.getElementById("caspioform").onsubmit=setDate; </SCRIPT>
  20. In my submission form, I wanted the value entered in one of my text fields to be automatically copied in my password and confirm password field. Does anyone have ideas about this? Thanks!
  21. I am looking to implement a simple validation on my form. I would like my user to not submit any numeric value in my submission form.
  22. Depending on what location is associated with a user(a column in the user table - the parameter), I would like to selectively hide a specific column in a report datapage. I am able to get Caspio to hide the column as desired on the preview Caspio page , but when deployed, Caspio seems to ALWAYS hide the column, regardless of the Country condition. Could you please take a look? This is where the datapage is deployed: https://dsmtest001.weebly.com/testjsreport.html. There are 2 user accounts-> 1. user1@test.com | 12341234 - Country is USA 2. user2@test.com | 12341234 - Country is Canada Column B should be hidden for the USA user but not the Canadian user. The selective functionality is achieved through the following code, inserted in the header of the report datapage: <script> alert('[@authfield:Country]' +' is the current country ' + ' -> going to hide column/row B if country is USA'); if ('[@authfield:Country]' === 'USA') { document.getElementById('targetxxx').innerHTML = "<style>#targetxxx table:nth-of-type(1) td:nth-of-type(2) {display: none;} </style>"; document.getElementById('targetxxx').innerHTML = "<style>#targetxxx table:nth-of-type(1) th:nth-of-type(2) {display: none;} </style>"; } </script> <div id="targetxxx"> and the below inserted in the footer: </div> Last but not least, attached is the sample Caspio app CaspioData_2019-Feb-25_2157.zip
  23. Here is my dilemma - my initial Client Table is set up to take in up to 2 address and up to 2 names per record to create a Client List. This is because if a husband and wife call us for work, we want them on the same account and such. Same with the Address field, because they may have a personal home and a rental home, in example. My Work Order form, which takes place after finding the client through the Client List, can only take in One address and One name. I couldn't put in two address fields into one dropdown with Caspio Standard Features. To combat that, I created a third page to act between the client list and the Work Order Form. This page will take in a parameter from a button on the Client List, where the user will select the Address and the Name to be on the Work Order Form. So, we made our own dropdown in an HTML table that includes both Addresses, so you can select one. Here is the code for the HTML block dropdown - <select id='test'> <option value="[@field:Primary_Client]">[@field:Primary_Client]</option> <option value="[@field:Additional_Client]">[@field:Additional_Client]</option> </select> I am needing help creating JS script for a query string value - it will send the selected value from the custom HTML Block Dropdown to the Work Order Form. Here are the table designs for the Client List and the Client Work Order list. You can see the Client Table has two address fields and the Client Work Order Table has one. Same with Client Names. The Client List Table is the 1st screenshot, and the Work Order Table is the 2nd.
  24. Hello. I would like to concatenate two text fields (both foreign keys) and populate a third text field in the same table with the concatenated value when submitting a DataPage. I understand how to do this when I am concatenating the stored value of the fields, but I would like to concatenate the display values of the two lookup fields, not their stored values. Please advise.
  25. Hi there, I would appreciate if someone could help me modifying styles of a dropdown on inline insert functionality of Tabular Report Datapage. I have a Cascading dropdown "EMAIL" where I would like to assign a special font and add a bottom border for each option. The challenge I am facing is that I have other dropdowns on this Datapage and I would like them to preserve default styling. Thanks, vitalikssssss
×
×
  • Create New...