Search the Community

Showing results for tags 'javascript'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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

Found 137 results

  1. Hello all: I have a script I use to create accordions using an image. But, I am want the hovered image and/or the clicked/tapped image to be different as the original accordion image. Any suggestions on the script are appreciated. The script I am using right now is: HTML BLOCK / DISABLED / BEFORE THE SECTION IN THE ACCORDION <center><img src="" onClick="Displayer(2)" ></center> <table id="Section2" style="display:none;"><br><td> THEN; HTML BLOCK / DISABLED / AFTER THE SECTION AFTER THE ACCORDION </td></table><br> AND A FOOTER SCRIPT: <script> function Displayer(n) { var check = document.getElementById('Section'+n); if( == 'none') {'inline'; } else {'none'; } } </script> --- Now on hover and/or "open" accordion, I want a different image. Thanks in advance
  2. Hi, I have a tabular report that list my users. One of the fields identify who is active and who is blocked. I want to show an padlock icon on the row of every blocked user. I mean: when the field [@field:Usuarios_Ativo^] value is "no". This is a "yes/no" field type I think that should be easy, but I am really struggling to make this work with my limited java skills. Many thanks Caspio minds!
  3. I'm trying to use an if statement in js that references a data field to see if there's a null value. I can't get the syntax to work though. Here's the code in the footer of a Details datapage: <script> var v_lk = parseFloat(document.getElementById("EditRecordmstrSuppliers_LinkedIn").value); if(!(v_lk) === "") { document.getElementById('section3').style.display = "inline"; document.getElementById('section4').style.display = "none"; } else { document.getElementById('section3').style.display = "none"; document.getElementById('section4').style.display = "inline"; } </script> What's odd is I got this code to work using a test field that was a number format, using <script> var v_lk = parseFloat(document.getElementById("EditRecordmstrSuppliers_TestNumberfield").value); if(!isNaN(v_lk)) So it seems like I'm just not referencing the 'live' field correctly because it's a text field instead of a number field. Does anyone know the correct way to reference a text field to check for null/blank values?
  4. Hi everyone, Does anyone know how to automatically resize an iframe that contains a tabular report? I set the container iframe to a fixed width and height. However, that gives me too much space upon hitting the Search button and viewing the results page, which is larger than the search form. I tried searching online but no luck. Please help. Thanks in advance. -dspolyglot
  5. Hi everyone, Does anyone know how to render a calculated field as HTML? I tried outputting HTML tags inside calculated fields, but they display as plain text. Thanks in advance. -dspolyglot
  6. 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.
  7. Hello everyone, Does someone know how to dynamically change the font color of a text column in a tabular report? For instance, I have a field named Indicator and it is the second column in the report. If the text value is equal to "Final", the font color must be set to red. Thanks in advance. -dspolyglot
  8. Clearing Values in A Search Form

    I have a search form and a results form on the same page. I reload the values in the search form (by receiving a parameter) so that the user can see what filters are being used to get the current results. This works great except... When I try and use the reset() form method it will not remove values that were previously submitted. I have also tried explicitly setting the value in those fields to nothing using something like this: function clearForm () { document.getElementsByName('cbParamVirtual7')[0].value=""; document.getElementById('cbParamVirtual17').value=""; document.getElementById('cbParamVirtual18').value=""; document.getElementById('cbParamVirtual19').value=""; document.getElementById('caspioform').reset(); } This does clear the checkboxes but will not clear the text fields if they have already been submitted in a query. I have attached an screenshot of the search filters. Any suggestions of how to solve this or work around the issue would be greatly appreciated. Thanks, Joel
  9. 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?
  10. Hi, I am using a script in an html block to detect certain criteria and display something based on that criteria. Here is my script: <script> var status = "[@field:Account_status]"; function invitepopup() {"[@field:User_ID]", "Invite", "menubar=1,resizable=1,width=500,height=500"); } if (status === "Yes") { document.write("Active"); } else { document.write('<a href="#" onclick="invitepopup()" title="Click to invite again">Invited by [@field:OriginUserName]</a>'); } </script> The if/else works fine, it shows "Active" for all the active users and "Click to invite again" for all the invitees ... however the link doesn't send the parameter properly.[@field:User_ID] is passed with the wrong User_ID. It seems to be passing the ID of the last user in the table, rather than the ID of the row it is in - it's currently showing 3 invitees in my table and they all are being received by the popup with the same ID (last user in the table). However if I just put this in as a plain (<a href="[@field:User_ID]" title="Click to invite again">Invited by [@field:OriginUserName]</a>), it works completely fine! Is there something in the script which is removing or replacing the User ID? I'm completely stumped! Hope someone can help! Many thanks Nikki
  11. I have an employee document submission form. This table has a field called [@field:hours]. Would like to have a virtual field which tells how many cumulative hours for a specific [@employeeID]. Would like the field to auto populate once the submission form is accessed. In other words, as soon as I select the employee from the results page, would like the details page to calculate how many hours this employee has. Thanks for your help. After Re-Reading my explanation. I could have simplified by saying, utilizing JavaScript, how do you sum a column and store the result in a field ?
  12. Hello guys, How can I use the timestamp as a default or initial value of my DateTime field in a Details page? I set the Form Type to Text Field, but I can't see the On Load option in the Advanced Tab. If I set the field as Hidden, I get that On Load option, but at the expense of not being able to edit it. Please help. -dspolyglot
  13. Is it possible, using javascript / jQuery, to extract data from specific fields in a Caspio table, or its results datapage, and assign that data to an array? If so, can this code be made to work by placing it in an HTML block inside the relevant datapage? Please give me an example of the code that would achieve this. Thanks
  14. Listbox Auto Height

    Anyone know how to have the listbox height be automatic based on how many records there are in it? At times my users have 2 records & others 5+ records so having a box that auto sizes per the number of records would be optimal.
  15. Hello, I saw this How-to article on changing the background of a row based on the value of a field: However, I need to delete the row instead of changing its background color. Also, I need to delete the row when a calculation returns a blank value. Is this possible? I don't know how to write JavaScript code.
  16. Hi there, I've built a page that has a grid of images, allowing users to click on these images to make a selection ... and then I want these selections to all be saved to a table as separate entries along with their user information. So far, I can get only 1 selection to pass to the table. If they click on one of the images, that is sent to the table, fine. I've set it up so that each selection is added to the string, separated by a comma, but then this passes to the table as a single entry with the comma separated string. This is my code: function SelDatasource1() { document.getElementById("Datasource1").className = "SELECTED"; document.getElementById("InsertRecordDatasource").value += "Datasource1,"; document.getElementById("InsertRecordProject").value += "[@authfield:User_info_Project],"; document.getElementById("InsertRecordDatasource").multiple = true; } function SelDatasource2() { document.getElementById("Datasource2").className = "SELECTED"; document.getElementById("InsertRecordDatasource").value += "Datasource2,"; document.getElementById("InsertRecordProject").value += "[@authfield:User_info_Project],"; document.getElementById("InsertRecordDatasource").multiple = true; } ...etc etc ... there are over 30 of these. If somebody selects Datasource1, Datasource5, Datasource12, it shows up in the table like this: PROJECT DATASOURCE Project1,Project1,Project1 Datasource1,Datasource5,Datasource12 I am using a Submission form datapage at present, and have added my code using html blocks and footer. 2 things I need help on: 1. I know there is a better way to add a comma to the string, other than putting it in like this (i.e. value +="Datasource1,"). This way, a comma is added for a single entry and at the end of a long string, which I don't want to do - can anybody help me with this? 2. Can I pass this comma separated string so that it shows up in my table like this: PROJECT DATASOURCE Project1 Datasource1 Project1 Datasource5 Project1 Datasource12 Any help would be greatly appreciated! Many thanks Nikki
  17. The login data page is being blocked from being used as soon as the page renders. I checked the console and the embed code seems to be causing a problem. This is the message in the console. A Parser-blocking, cross-origin script,…nI9YzU0NDUwMDBkZTVmNTFjZGIwMmU0MzNlODJiOQ==&cbEmbedTimeStamp=1487653960962, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity. See for more details. f_cbload @ embed.js:1 (anonymous) @ ?cbr=c544500…:56 The chrome status link talks about 2g connections. I'm on a desktop. Does anyone have a clue on what could cause this issue?
  18. Any Programmers for Hire

    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!
  19. Hi there, I would like to share a JS solution which I have used for my project. This script that can be used to clear fields in the bulk edit screen. The bulk edit screen typically displays the data from the last update, and my JS allows not show the previous content of fields. Place following JS into the Footer of Bulk edit screen. Make sure that you have disabled HTML editor. <script type="text/javascript"> var aaa= document.getElementById("BulkUpdateFormBody"); var v_li = aaa.getElementsByTagName("input"); var v_ls = aaa.getElementsByTagName("select"); var v_lt = aaa.getElementsByTagName("textarea"); var f_tmpf = function(v_list, v_resList){ var v_res = v_resList || []; var v_length = v_list.length; for(var v_i = 0; v_i < v_length; v_i++) if((v_list[v_i].type || "").toUpperCase()!="HIDDEN" && (v_list[v_i].nodeName||'').search(/input|select|textarea/ig) != -1) v_res.push(v_list[v_i]); v_resList = v_res; return v_res; } var v_cleanI=f_tmpf(v_lt, f_tmpf(v_ls, f_tmpf(v_li, []))); v_cleanI.forEach(function(v_i){ v_i.value = ""; }); </script> I hope this will be useful for someone.
  20. Hi I need to add a button that will redirect to a specific page on a HTML form This button must be visible or not visible based on a condition from an authentication field I created the html form and added this code: <script> if("[@authfield:User_Role]" == "Manager") { ---> Add a code here that will show a button that will redirect to a page } </script> Can someone send me an example code that I can place between the brackets? I tried several options but nothing works.
  21. I have a combined chart and report datapage that I use to display a list of jobs and their status. I would like the list and chart to have dynamic colours according to their status. This is quite easily accomplished, and in fact I have already completed it. My issue comes in place with AJAX. I cannot disable AJAX on a combined chart/report datapage, therefore when I do a bulk edit on my report, the chart reverts back to the default colours. I am guessing this is because the chart loads without running the javascript in the datapage. Is there a way to execute javascript in a datapage not only on load, but also on an AJAX call? Thanks, Josh EDIT: I just realized that it's not because of the combined chart/report that I cannot turn off AJAX, but it is because of the grid edit.
  22. Hi Everyone, I'm very much a newbie on the Caspio platform, but I've been making great strides. I have a datapage created that has two columns that can have a value of an "N". I would like to create some form of code to allow the value to blink, if it is equal "N". Is that possible and can anyone assist me in accomplishing this? Thank you! -Anthony
  23. When I had my onboarding with Caspio helped with some Java Script to replace a blank space with " OR " so we could search on a field using "Contains" versus "Equals". We are now trying to duplicate this code in a new data page and it is not working. The data page where it does work is "Search Bar" on field "Virtual4" and the code is in the header and the footer. The results are then passed to another data page. I now want to create a data page where the search is contained in the page and the results are not passed. The functionality we need is to cut & paste style #'s into the search box and upon clicking submit the script runs and replaces the space with " OR " and the "contains" search runs. Here is an example use case Cut and paste "CM7661 CM7662 CM7854" Click Submit Script runs and replaces the spaces with " OR " and the query looks like "CM7661 OR CM7662 OR CM7854" The results for the 3 style numbers are returned The code we have in the header is: <div id="search"> The code we have in the footer is: <script> document.getElementById('search').onsubmit= function (){ var txt = document.getElementById('cbParamSeason_Table_Style').value; document.getElementById('cbParamSeason_Table_Style').value = txt.replace(/\s+/g, " OR "); } </script> Why is this not working? Thanks, Jeff
  24. I am attempting to use a simply JavaScript to create an extended cost on a submission form. I have a few lines of this. When I add the JavaScript, only the last script works. Almost like it is canceling out the prior. I do not know how to make them both work or how to combine them into one larger script. Any assistance would be greatly appreciated. My lines of code are inserted below. They work individually but not both at once on the same submission form. <SCRIPT LANGUAGE="JavaScript"> function calculateextcost1() { var v_item1 = parseFloat(document.getElementById("InsertRecordITEMUNITS1").value); if (isNaN(v_item1)) v_item1 = 0; var v_cost1 = parseFloat(document.getElementById("InsertRecordITEMCOST1").value); if (isNaN(v_cost1)) v_cost1 = 0; var v_extcost1 = (v_item1 * v_cost1); document.getElementById("InsertRecordITEMEXTCOST1").value = (v_extcost1); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onchange = calculateextcost1; </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> function calculateextcost2() { var v_item2 = parseFloat(document.getElementById("InsertRecordITEMUNITS2").value); if (isNaN(v_item2)) v_item2 = 0; var v_cost2 = parseFloat(document.getElementById("InsertRecordITEMCOST2").value); if (isNaN(v_cost2)) v_cost2 = 0; var v_extcost2 = (v_item2 * v_cost2); document.getElementById("InsertRecordITEMEXTCOST2").value = (v_extcost2); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onchange = calculateextcost2; </SCRIPT>
  25. Hi, I want to output a parent record and its linked child records (a variable number of records) as a JSON array to display in a html page that consists of sections. Each section contains one or more fields from either the child or parent record(s). I would like to be able to push the data upon clicking a button. Following is an example of what I mean. (NB: The actual Parent Table has 10 fields and the Child table has 60 fields, including some that are formula fields). Parent table fields: FIELD: PID PF1 PF2 PF3 TYPE (autonumber) text date number Child Table fields: FIELD: CID (autonumber) PID CF2 CF3 CF4 CF5 TYPE (autonumber) integer text date number checkbox PID is an Integer field and relationship linked to same field in Parent table. Section 1 [CF3-record1] [CF3-record2] [CF3-record3] Section 2 [CF2-record1] [CF4-record1] [CF2-record2] [CF4-record2] [CF2-record3] [CF4-record3] Section 3 [CF5-record1] [PF1] [CF5-record2] [PF1] [CF5-record3] [PF1] It would be much appreciated if someone can assist by providing some instructions and javascript if needed. Many thanks!