Jump to content

Search the Community

Showing results for tags 'javascript'.

  • 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

  1. Hi there, I have records called Cards, which span 5 different stages. If the first part of the Card is completed, the user is in stage 1. If the first and second part is completed, they are in stage 2 etc etc. I'd like to automate this (currently they can choose their own stage via a dropdown), and have written the following script, but it's not working. <script> var count_Brief= ("[@field:Brief]").length; var count_AnalystNotes = ("[@field:Analyst_Notes]").length; var count_RecTest = ("[@field:Recommended_test]").length; var count_Result= ("[@field:Actual_result]").length; if (count_Brief > 1) { document.getElementById("EditRecordStage").innerHTML = "2. Brief"; } else if (count_Brief > 1 && count_AnalystNotes > 1) { document.getElementById("EditRecordStage").value = "3. Analysis"; } else if (count_Brief > 1 && count_AnalystNotes > 1 && count_RecTest > 1) { document.getElementById("EditRecordStage").value = "4. Test"; } else if (count_Brief > 1 && count_AnalystNotes > 1 && count_RecTest > 1 && count_Result > 1) { document.getElementById("EditRecordStage").value = "5. Result"; } else { document.getElementById("EditRecordStage").value = "1. Question"; } </script> Does anyone have any insight here? Many thanks Nikki
  2. So I am trying to limit a user from selecting an entry using an autocomplete (or I guess could be a dropdown). This user entry field is using a column in a table as the source. This is a complete list with all possible selections available (no replicates, and they are unique). The user selects 3 selections on a weekly basis (Pick1, Pick2, Pick3) and the items are entered into the Pick table. The catch is that the user CANNOT pick any of the previous selections from the previous week in the current submit week. So I have created a formula in the Pick table to concatenate all 3 picks each week for a user into one field. And I have been able to use this concatenated field in a RULE to at least warn the user that they are making an illegal choice. However, I cannot remove the previous picks from the source table to make that not even available for selecting. And I cannot prevent the user from still click the submit button (unless there is a way to implement a RULE to hide submit button until user fixes their selections...) So I am wondering if there is a way to remove the previous picks from the users options to select. These picks (text255 fields) also have an accompanying ID with them. And these text values are also unique, I enforce this. Example is the user is supposed to select 3 numbers from a table populated with the numbers 1 to 20. They cannot select the same number in the same session. So they select 1, 2, 3 in week 1. Now in week #2, they can select ANY 3 numbers (no repeats again) EXCEPT 1, 2, 3. So can the numbers 1, 2, 3 be removed from the dropdown (or autocomplete list) for just week 2. They are legal choices in week 3, but now week 2's number selections are "illegal". Each user will have the same situation, and the datapage is authenticated and I use the USERID. Thanks in advance
  3. Hi, I have an html block in a Details page where I'm trying to show/hide a div based on the value of a Virtual field. The virtual field is set to Hidden and gets an Authentication value on load for data (a country name, in this case). I can't quite get the show/hide to work. I've used this code before and it works well so there must be some syntax mistake in this example. Does anyone have an idea with that might be? Thanks! <div id="section1">Print AUS Version</div> <script> var v_virt = document.getElementByID("cbParamVirtual13").value; if(v_virt=="Australia") { document.getElementById('section1').style.display = "block"; } else { document.getElementById('section1').style.display = "none"; } </script>
  4. 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() { window.open("https://c3fot467.caspio.com/dp.asp?AppKey=34fe4000f38aceb2a5da4c74bea2&UserID=[@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. https://c3fot467.caspio.com/dp.asp?AppKey=34fe4000f38aceb2a5da4c74bea2&UserID=[@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="https://c3fot467.caspio.com/dp.asp?AppKey=34fe4000f38aceb2a5da4c74bea2&UserID=[@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
  5. Hi I am re-using a javascript code I have used many times successfully in the past, but I can't seem to get it to work now. It DOES work when I preview the datapage, but on the live website it does not. I am using a conditional display that I have confirmed still works on other live websites, it was copied directly from a datapage that is currently working but I switched out the field using field picker and the image link... <script> var link_text="[@field:Make]"; var src_address="https://banjimmie.weebly.com/uploads/2/8/3/6/28360873/chevy_orig.png"; var image_to_display='<a href="' + link_text + '"><img src="' + src_address + '"></a>'; if (link_text=='Chevrolet') { document.write(image_to_display); } </script> Previewing this directly from the datapage WORKS. Viewing on my live website DOES NOT. I use Weebly, and this code still works on all my other weebly sites for other pages. I am very confused. I use a hidden page on weebly to view the image rather than uploading to Caspio. This works on my other sites. thanks melissa
  6. Hi all, I'm trying to do authentication in a modal window. It works fine on the happy path, as in the user inputs valid credentials . However, if a user puts in bad credentials or no credentials, the page refreshes and in order to see the error message, you must click the login button again. This is less than optimal UX. I have tried all the options in the standard Caspio feature set, and still can't seem to redirect to the modal window with the error message displayed on fail. I'm wondering if there's a way to achieve this behavior with javascript, or a clever workaround. Thanks.
  7. 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>
  8. Hi there, I am using the standard autosubmit script to send users to one form using parameters to auto fill it and autosubmit it and then on to another form. However some users get stuck in a loop if a field in the first autosubmit form are already in the table, and they never get to the second form and don't see the error message. Is there a way to write into this script "if field already exists in table [users] DO NOT autosubmit, instead show an error message? <script type="text/javascript"> if(document.getElementById("caspioform")) { document.getElementById("caspioform").style.display = 'none'; setTimeout('document.forms["caspioform"].submit()',1000); } </script> Many thanks Nikki
  9. I have a simple pivot table with 'Years' field across the top and a 'Regions' field and a 'Countries' field down the side. The regions field is collapsible, so the User has the choice whether or not to show the countries inside each region. So far so good. Problem is that In the regions column I want to be able to show selected regions with the collapsible option, but I also want to show (in the same column) other selected regions which do NOT have the collapsible option and therefore just show the aggregate total of their countries. I know this is not a regular option, so I'd be willing to use javascript. Can anyone give guidance on the code to use to access selected fields and records in a pivot table, and also how to apply/remove the 'collapsible' feature at runtime. Many thanks
  10. I am trying to pass the value from specific column totals for use in html page(s) and/or virtual fields. Any help is appreciated. e.g. table with 3 columns and n rows I want to retrieve and pass the total value of column 1, column 2 and column 3 for use on a different webpage or for a custom html field Thanks in advance
  11. 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="http://assets.goplaypool.com/files/theme/appcas/updatepass000.png" 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(check.style.display == 'none') { check.style.display='inline'; } else { check.style.display='none'; } } </script> --- Now on hover and/or "open" accordion, I want a different image. Thanks in advance
  12. 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!
  13. 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?
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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 ?
  19. 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
  20. 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.
  21. Hello, I saw this How-to article on changing the background of a row based on the value of a field: http://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-dynamically-change-the-background-of-a-results-page/ 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.
  22. 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
  23. 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, https://c4fot477.caspio.com/dp.asp?cbqe=QXBwS2V5PWM1NDQ1MDAwZGU1ZjUxY2RiMDJ…nI9YzU0NDUwMDBkZTVmNTFjZGIwMmU0MzNlODJiOQ==&cbEmbedTimeStamp=1487653960962, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity. See https://www.chromestatus.com/feature/5718547946799104 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?
  24. 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.
  25. 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.
×
×
  • Create New...