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 195 results

  1. I'm using a barcode reader to scan an order in a form, passing parameters to another form that scans the product sku, and the 2nd form opens itself up after each sku for however many skus are related to the order. It works well. The sum of the skus scanned by product are in another report datapage that updates on the same page the 2nd form is on. The report queries both the table used to scan skus for a sum by product, and a table containing data from shipping software that contains what should be shipped within it's table.... The only issue with this setup is that I'd prefer to get rid of the 2nd form, and just scan the order# , then pass parameters to the report page and use inline edit to scan skus.... the barcode reader hits enter itself with each scan and I have the button hidden... I can't get this done BECAUSE I can't get the cursor to focus on the inline edit field for skus when the first page opens the report. I think there should be an option for this like there is for forms....but since there isn't, I've been trying a bunch of scripts....here's my latest.... Footer: <script> { document.getElementsByName('EditRecordInlineAddlineItemsku').focus(); document.getElementsByName('EditRecordInlineAddlineItemsku').select(); } </script> Any ideas how I might fix this???
  2. Hi everyone, I am encountering an issue wherein a "Data Table" tooltip appears everytime I hover on a report data cell. I want to remove that one. Please help. -dspolyglot
  3. Hello all, I have an Update datapage where, on Submit, I need to 1) show a popup message saying the changes were saved and 2) close the window or tab of the host page. I set the 'destination' of the datapage to 'Close Window' and put the below js in the footer to show the message. <SCRIPT LANGUAGE="JavaScript"> function myFunction() { alert ('Your updates have been saved') } document.getElementById("caspioform").onsubmit = myFunction; </SCRIPT> The problem is the js seems to block the 'Close Window' function and the page just refreshes to 'same form' and shows the standard 'data has been updated' message. So it seems to me I could put some kind of 'close window' function in the above js and put that in the 'message' section of the Destination wizard. I tried the below but it doesn't actually close the window/tab. <SCRIPT LANGUAGE="JavaScript"> function myFunction() { alert ('Your updates have been saved'); window.close(); } document.getElementById("caspioform").onsubmit = myFunction; </SCRIPT> Basically, I need, on Submit, the tab/window to close and a message to pop up saying data has been saved. Does anyone know how to do this?
  4. 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.
  5. I want to insert a the next 30th of June as a field value in a online form, based on the entered start date of a contract e.g. is the start date is earlier than 30 June of the current year, the value I need is 30 June this year, if the start date falls in July or later, is should be 30 June next year. (I need this date to do further calculations for milestone periods and budgets) I have tried to modify a few scripts dealing with related issues, but I cannot seem to make it work for this problem, I get either the wrong date format or no calculation/result at all Any help sincerely appreciated.
  6. In my search form in Reports DataPage, I want to select all the items in a multi-select listbox when my checkbox is checked. Also, when it is unchecked, all the items should be deselected. Any ideas?
  7. I've got 3 fields set as Listboxes on a Submit datapage. I'm using js to select multiple records and enter them comma delimited upon submission. The code works fine when doing it with one Listbox but I can't figure out how to get it to work for all three. Right now I'm just repeating the code for each listbox (with a different variable name for each) but it doesn't work. I imagine there's a more unified way to do this so the code covers all 3 Listboxes. Anyone have any ideas? Here's the code so far (it's obviously wrong to repeat the entire script 3 times, I just don't know how to unify it): <script type="text/javascript"> var v_state = "[@field:Field1]" ; var o_state = document.getElementById("InsertRecordField1") ; o_state.multiple = true ; function f_listbox() { if ( v_state.indexOf(",") > 0 ) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_state[i].value == v_state) { o_state.remove(i); break ; } } var o_st = v_state.split(", ") ; for (var j=0 ; j < o_st.length; j++) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_st[j]== o_state.options[i].value){ o_state.options[i].selected = true ; break ; } } } } } //window.onload = f_listbox ; document.addEventListener('DataPageReady', f_listbox()); </script> <script type="text/javascript"> var v_state2 = "[@field:Field2]" ; var o_state2 = document.getElementById("InsertRecordField2") ; o_state2.multiple = true ; function f_listbox2() { if ( v_state2.indexOf(",") > 0 ) { for (var i2=0 ; i2 < o_state2.options.length; i2++ ) { if(o_state2[i2].value == v_state2) { o_state2.remove(i2); break ; } } var o_st2 = v_state2.split(", ") ; for (var j2=0 ; j2 < o_st2.length; j2++) { for (var i2=0 ; i2 < o_state2.options.length; i2++ ) { if(o_st2[j2]== o_state2.options[i2].value){ o_state2.options[i2].selected = true ; break ; } } } } } //window.onload = f_listbox2 ; document.addEventListener('DataPageReady', f_listbox2()); </script> <script type="text/javascript"> var v_state3 = "[@field:Field3]" ; var o_state3 = document.getElementById("InsertRecordField3") ; o_state3.multiple = true ; function f_listbox3() { if ( v_state3.indexOf(",") > 0 ) { for (var i3=0 ; i3 < o_state3.options.length; i3++ ) { if(o_state3[i3].value == v_state3) { o_state3.remove(i3); break ; } } var o_st3 = v_state3.split(", ") ; for (var j3=0 ; j3 < o_st3.length; j3++) { for (var i3=0 ; i3 < o_state3.options.length; i3++ ) { if(o_st3[j3]== o_state3.options[i3].value){ o_state3.options[i3].selected = true ; break ; } } } } } //window.onload = f_listbox3 ; document.addEventListener('DataPageReady', f_listbox3()); </script>
  8. 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>
  9. 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.
  10. 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>
  11. 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?
  12. 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
  13. 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?
  14. 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>
  15. 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!
  16. 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
  17. 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!
  18. 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
  19. 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>
  20. 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?
  21. 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
  22. 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.
  23. 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!
  24. 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-
  25. 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>
×
×
  • Create New...