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


Found 165 results

  1. Hello all, I have figured out how to use the page view increment in a details page, but I wanted to update a counter on submission and don't see a similar element for selection. Can this be done with a script? I'm not much of a programmer, and had tried the following: <SCRIPT LANGUAGE="JavaScript"> function count() { var i = parseFloat(document.getElementById("Count").value); i=i+1; document.getElementById("Count").value = i } document.getElementById("Countsubmission").onsubmit=calculate; </SCRIPT> Any help would be appreciated!
  2. Hi everyone, I'm fairly new to the world of JavaScript and have the following scenario on a submission page: During submission, my users select a business client using an AutoComplete field. Once they selected a client, two virtual fields pull two values for this client from an external table. These lookups are set up using cascading text field. On the same DataPage, there is a radio button with two options. Should the two virtual fields remain blank (basically meaning that there is no value for either of the fields for this client in the external table), the 2nd radio button option should be selected and the field hidden to prevent user interaction. The hiding and selection part works fine, but it seems that I'm not able to get the value from the virtual fields and my script stops working as soon as I add the condition that involves the value of any of the two virtual fields: <script type= "text/javascript"> function AMFCheck() { var AMF1 = document.getElementById('cbParamVirtual12')[0].value; var AMF2 = document.getElementById('cbParamVirtual13')[0].value; if (AMF1 == "" && AMF2 == "" ) { document.getElementById("InsertRecordAMF_payable1").checked = true; document.getElementById("InsertRecordAMF_payable").style.display = "none"; } } document.getElementById("caspioform").onchange=AMFCheck; </script> I'd be really grateful for any help. Thanks, Christof
  3. I have found that if I manually click on a dropdown that is a parent to another cascading dropdown, the cascading dropdown works. But when I try to use javascript to change the value of that parent dropdown, I find that it does not kick off the cascading activity of the cascading dropdown that is connect to it. Strangely, the value changes in the parent dropdown (so it works), but it doesn't impact the cascading dropdown. The js code I am using to change the parent dropdown value is: document.getElementsByName("cbParamVirtual1")[0].value="2012"; which successfully updates the value, so I know the JS works. But it doesn't impact the cascading dropdown. Is there an onchange event that is misfiring? Any suggestions?
  4. Hello. I have a submission form with a popup link. The form has a Job dropdown element that is being used as a parameter to pass to the popup. When a Job is selected from the dropdown and the popup link is clicked, a List Report pops up and shows records related to the Job that was selected. This works great. However, I need an element in the form to be cascading, and the Job dropdown has to be the parent field for this. When I enable the cascading feature, my popup stops working. I get an Uncaught TypeError of null, stating that the parameter field name cannot be found. So, Job can be found before it is made a parent field for a cascading element, but once it is made the parent field, it stops working. Here is my code. <script> var fieldName = "Job"; // The name of your table field. var paramName = "Job"; // The name of your parameter /* No modifications necessary beyond this line */ var inputField = document.querySelector('[action*="[@cbAppKey]"] #InsertRecord' + fieldName); var linkToChild = document.querySelector('[action*="[@cbAppKey]"] #linkToChild'); var baseUrl = linkToChild.href; //do not touch var moddedUrl = baseUrl; //do not touch function updateLink() { moddedUrl = `${baseUrl}?${paramName}=${this.value}` } ['change', 'keydown','keyup'].forEach( function(e) { inputField.addEventListener(e, updateLink); }); inputField.dispatchEvent(new Event('change')); linkToChild.onclick = function() { window.open(moddedUrl, '', 'resizable=no,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no'); return false; } </script> Any help would be appreciated. This is maddening me, haha.
  5. Hi, I'm new to using Caspio bridge. I am more accustomed to creating web forms directly using PHP and JQuery, but I need to make some updates to a Caspio form. I have a submission form that has 4 text fields. The first 3 fields will accept currency values. The last field sum sum the previous one in real time. For example, if in field 1 I enter value 25, then 25 should show in field 4 when event focus changes. If fields 1 and 2 have values 25 and 17, respectively, then when the event focus changes from field 2 the value in field 4 should be 42. I know how to d9 this using straight JavaScript or J-Query, but I am having trouble creating functions and adding triggers and events to the elements in my submission form. Any help would be greatly appreciated.
  6. Contained in this HTML block are two options:Google Doc<br />&nbsp; &nbsp;<a href="[@field:Employee_Document_Link]" target="_blank"><img alt="File Quick View" src="http://account-ability.net/webapps/hca/images/Entypo_e731(1)_32.png" style="width: 32px; height: 32px;" /></a><br /><br />Uploaded Doc<br />&nbsp; &nbsp; <a href="https://c0axa147.caspio.com/dp/76292000e18ad3e841834930b209?Employee_Document_ID=[@field:Employee_Document_ID]" target="_blank"><img alt="File Quick View" src="http://account-ability.net/webapps/hca/images/Entypo_e731(1)_32.png" style="width: 32px; height: 32px;" /></a>The user clicks on either of the document icons. What I am trying to achieve is for the "Google Doc" icon to show only when the [@field:Employee_Document_Link] is not empty the and "Uploaded Doc" icon to only show when the [@field:Employee_Document_Upload] is not empty. Would very much appreciate any help in this.
  7. I have a submission form where the user clicks a link and it's supposed to do a simple calculation based on a few fields. I can't seem to get it to work right though. The fields are: MRP (currency) Supplier_Discount (number) Cost (currency) It's a simple calculation I need to do. The user enters the MRP and Supplier Discount and clicks the link to calculate and fill in the Cost. The calculation is Cost=MRP-(MRP*Supplier_Discount) so if: MRP = 1000 Supplier_Discount = .3 Cost = 700 I tested the link calling the js and it works (used a message to test it) and also tested simply doing Cost= MRP and that worked also. It's when I try to call Supplier_Discount and do a calculation that it's not working. I'm not sure if it's because Supplier_Discount is a number field and not currency or if I'm just missing some syntax but any help would be greatly appreciated. I have this in an html block at the bottom of the submission form: <SCRIPT LANGUAGE="JavaScript"> $("#k_cyourcost").click(function cyourcost(){ var MRP = document.getElementById("InsertRecordMRP").value; var Supplier_Discount = document.getElementById("InsertRecordSupplier_Discount").value; var Cost = (MRP)-((MRP)*(Supplier_Discount)); document.getElementById("InsertRecordCost").value= Cost; }); </SCRIPT>
  8. 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
  9. I have an update record data page, where I want to stamp a UTC date in a field. Caspio does not allow calculated values on an update record data page, so I need to use Javascript to do it. If anyone knows how to do it, please let me know by sharing the javascript needed to accomplish the task. I will be happy to tip whomever provides the first useful answer with NavCoin. You may get a NavCoin wallet on Navcoin.org. Thank you.
  10. I have used the forum to get to this point so you may have seen some of my code that I grabbed from other posts. I have a single record update form, where I only want them to be able to select the update button if all of the fields are marked as 'complete'. It should be known that all of the 'complete' or 'missing data' fields are formulas in the table, however, I am referencing virtual fields in my code that are set to the formula fields. The url to my form is here: https://c5amf675.caspio.com/dp/32576000f879393a309d4a97b1bd My code for checking the virtual field values is here: <script language="JavaScript"> function check_numbers() { var disabled = false; if (parseFloat(document.getElementById("cbParamVirtual").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtua2").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual3").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual4").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual5").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual6").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual7").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual8").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual9").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual10").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual11").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual12").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual13").value)=='Complete') disabled = true; if (parseFloat(document.getElementById("cbParamVirtual14").value)=='Complete') disabled = true; if (disabled) { alert("All fields must be complete"); return false; } } document.getElementById("caspioform").onsubmit=check_numbers; </script> What is really weird, is that even the following code will not show a message when I click on the update button. <SCRIPT LANGUAGE="JavaScript"> function check() { window.alert("Thank you.. Information is registered!"); } document.getElementById("caspioform").onsubmit=check; </SCRIPT> I tried this small alert function after I couldn't get my regular code to work. This was on its own and did not work. I am thinking that there is an issue somewhere where the onclick is not registering. Do any of you have any idea what might be the problem?
  11. Perzival

    Pop-up Form on Submit

    Hello everyone, I am trying to create a submission form with four fields, NAME, EMAIL, CONTACT PERSON and RESUME(File Data type). Now I want to have a user interaction that will confirm if the user wants to proceed when he/she submit a record. e.g. "Are you sure you want to apply for this Position?" Any help would be much appreciated. Many Thanks!
  12. I need to calculate the total value of the fields GAD1 - GAD7 which are all drop downs with text that have a corresponding numeric value. that total needs to be inserted into the hidden field GAD_Score when the user submits the page. All of the fields mentioned above are number datatypes in the corresponding table. when I test it out using either the preview or on my website I get nothing in the GAD_Score field in my table, what am I missing? Here is the code I put in the footer of my data page. <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_GAD1 = parseFloat(document.getElementById("InsertRecordGAD_Q1").value); var v_GAD2 = parseFloat(document.getElementById("InsertRecordGAD_Q2").value); var v_GAD3 = parseFloat(document.getElementById("InsertRecordGAD_Q3").value); var v_GAD4 = parseFloat(document.getElementById("InsertRecordGAD_Q4").value); var v_GAD5 = parseFloat(document.getElementById("InsertRecordGAD_Q5").value); var v_GAD6 = parseFloat(document.getElementById("InsertRecordGAD_Q6").value); var v_GAD7 = parseFloat(document.getElementById("InsertRecordGAD_Q7").value); var v_GADSCORE= v_GAD1 + v_GAD2 + v_GAD3 + v_GAD4 + v_GAD5 + v_GAD6 + v_GAD7; document.getElementById("InsertRecordGAD_Score").value = Math.round(v_GADSCORE); } document.getElementById("caspioform").onsubmit=calculate; </SCRIPT> Any help would be greatly appreciated
  13. Years ago I added some JavaScript to my forms to prevent clients from selecting a "due date" that isn't at least two weeks in the future. Recently that code has stopped working, and all submissions are allowed through, regardless of the date selected. I think this may be tied to the recent Caspio updates. At least, that's all that I can see; the forms themselves haven't changed. Below I'm pasting my JS, which resides in the footer area of my forms. Any ideas would be greatly appreciated. Thanks! (BTW, I know two weeks is 14 days, not 13. But my users don't seem to recognize that, so I made this small allowance.) <SCRIPT LANGUAGE="JavaScript"> function check_date() { var entered_value = document.getElementById("InsertRecorddateNeeded").value; var entered_date = new Date(entered_value); var two_week_date = new Date(); two_week_date.setDate(two_week_date.getDate() + 13); if(entered_date < two_week_date) { alert("Must be at least 2 weeks in future"); return false; } } document.getElementById("caspioform").onsubmit=check_date; </SCRIPT>
  14. I have an aggregated tabular report. Once I expand all the columns, I would like the data in one of the columns become links (using JavaScript). Please refer to the attached image. In this case I would like the data in the column EVENTO become links. Thanks!
  15. Hello. I have a file field where a user can load in an image. After they load the image and click update, I've got some java that runs. I'd like to populate the url of that image in another field. I've got something like this that fires when the user updates, but I can't find the correct value for the image url and it clearly doesn't work: document.getElementById("EditRecordtextfield_1").value = document.getElementById("EditRecordImage_File_1").SRC Thought? Is this even possible? DP
  16. Hello, Does anybody know how to disable autocomplete on text input fields? THANKS
  17. What I am trying to accomplish in my details report data page is to Sum the weight of each product. s1 = product ID for the first item in the sale s1w = product weight or units for the first item in the sale I can not just sum all my "sw" fields because each one could possibly be tied to a different product. I have come up with the following JS solution, which is intended to run when an HTML button is clicked. Here is what I have: In an HTML block at the top of the page: <input type="button" value="product 1 weight" onclick="prod1w()" /> In the footer of the page: <script> function prod1w() { var v_s1 = parseFloat(document.getElementById("InsertRecords1").value); var v_s2 = parseFloat(document.getElementById("InsertRecords2").value); var v_s3 = parseFloat(document.getElementById("InsertRecords3").value); var v_s4 = parseFloat(document.getElementById("InsertRecords4").value); var v_s5 = parseFloat(document.getElementById("InsertRecords5").value); var v_s6 = parseFloat(document.getElementById("InsertRecords6").value); var v_s7 = parseFloat(document.getElementById("InsertRecords7").value); var v_s8 = parseFloat(document.getElementById("InsertRecords8").value); var v_s9 = parseFloat(document.getElementById("InsertRecords9").value); var v_s10 = parseFloat(document.getElementById("InsertRecords10").value); if (v_s1 == 1) { var v_prod1s1w = parseFloat(document.getElementById("InsertRecords1w").value); } else { var v_prod1s1w = '0'; } if (v_s2 == 1) { var v_prod1s2w = parseFloat(document.getElementById("InsertRecords2w").value); } else { var v_prod1s2w = '0'; } if (v_s3 == 1) { var v_prod1s3w = parseFloat(document.getElementById("InsertRecords3w").value); } else { var v_prod1s3w = '0'; } if (v_s4 == 1) { var v_prod1s4w = parseFloat(document.getElementById("InsertRecords4w").value); } else { var v_prod1s4w = '0'; } if (v_s5 == 1) { var v_prod1s5w = parseFloat(document.getElementById("InsertRecords5w").value); } else { var v_prod1s5w = '0'; } if (v_s6 == 1) { var v_prod1s6w = parseFloat(document.getElementById("InsertRecords6w").value); } else { var v_prod1s6w = '0'; } if (v_s7 == 1) { var v_prod1s7w = parseFloat(document.getElementById("InsertRecords7w").value); } else { var v_prod1s7w = '0'; } if (v_s8 == 1) { var v_prod1s8w = parseFloat(document.getElementById("InsertRecords8w").value); } else { var v_prod1s8w = '0'; } if (v_s9 == 1) { var v_prod1s9w = parseFloat(document.getElementById("InsertRecords9w").value); } else { var v_prod1s9w = '0'; } if (v_s10 == 1) { var v_prod1s10w = parseFloat(document.getElementById("InsertRecords10w").value); } else { var v_prod1s10w = '0'; } var v_prod1w = v_prod1s1w + v_prod1s2w + v_prod1s3w + v_prod1s4w + v_prod1s5w + v_prod1s6w + v_prod1s7w + v_prod1s8w + v_prod1s9w + v_prod1s10w; document.getElementById("InsertRecordprod1w").value = (v_prod1w); } </script> Update: The problem was that the Element ID in this data page is EditRecord, I changed that out but am now running into a different issue. I am going to have about 20 different product ID's. I started to expand on this and added a second product ID function code segment. My buttons are working and values are coming into my prod1w and prod2w fields. However, something is going wrong in the calculation. The attachment shows whats happening. Based on what was entered here prod1w and prod2w should be 11.5 To add to the confusion, when products are entered in order (so s1,s2 and s3 = 1) the code works and you get the correct answer. However that is not how users will be submitting the information. I tried adjusting the else values from '0'; to just 0; but that broke it. I tried changing this line to: document.getElementById("InsertRecordprod1w").value = math.round(v_prod1w); Which lead to the same results. Any ideas? Any and all help is greatly appreciated.
  18. Clint

    Create json File

    I'm sorry for what is probably a simple question. If I want to use data from a view (ideally - or a table if I had to), making it accessible to a javascript charting library (like d3.js) , how do I export it (or make it real-time accessible) as a json file without jumping through a bunch of hoops? For some reason I'm not making the connection... Thanks so much! Clint
  19. Can any buddy help me i need to add $ symbol on product_price and sub_total.. <script> $( document ).ready(function() { $(document).on("input paste keyup", ".product_qty", function( event ) { var product_quantity = 0; var product_price = 0; var gst_amount = 0; var sub_total = 0; var total_qty = 0; var grand_total = 0 product_quantity = $(this).val(); product_price = $(this).parent().prev().html(); sub_total = product_price * product_quantity; $(this).parent().next().html(sub_total); $('.product_qty' ).each( function( k, v ) { product_quantity = parseInt ( $(this).val() ) ? parseInt ( $(this).val() ) : 0; product_price = parseFloat($(this).parent().prev().html())?parseFloat($(this).parent().prev().html()):0; console.log(product_quantity); console.log(product_price); sub_total = parseFloat ( product_price * product_quantity ); console.log(sub_total); total_qty +=product_quantity; grand_total += sub_total; }); if ( grand_total > 0 ){ gst_amount = ( grand_total * 6 ) /100; } $("#total_qty").html(total_qty); $("#total_amount").html(grand_total); grand_total +=gst_amount; $("#gst_amount").html(gst_amount); $("#discount_amount").html(0); $("#grand_total").html(grand_total); }); // $(document).on("click", ".delete", function( event ) { var cart_item = 0; $(this).parent().parent().remove(); cart_item = $('.product_qty').length; if ( cart_item <= 0 ) { $("#total_qty").html('0'); $("#total_amount").html('0'); $("#gst_amount").html('0'); $("#discount_amount").html(0); $("#grand_total").html('0'); } else { $('.product_qty').trigger('keyup'); } }); }); </script>
  20. Hello! I am using the HTTP basic authentication method for my mobile app and have followed the POST request as outlined on the website. My ajax call is as follows: $(document).ready (function () { $('button').click(function () { var Client_ID = $('clientid').val(); var Client_Secret = $('clientsecret').val(); $.ajax ({ type: 'POST', url: 'Token endpoint', data: 'grant_type=client_credentials', headers: { 'Authorization' : 'Basic Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ=' }, success: function(data) { window.location.href = 'page1.html'; }, }); }); I encoded the string "Client_ID:Client_Secret" as advised too. Upon checking my network console, I'm getting a 400 error. Can anyone help?
  21. Hello.. I have a tabular report that will not recognize an element using document.getElementById( "elmName" ) (loctated in the Header of a report), if the datapage is deployed using ASYNC deployment... <script type="text/javascript" src="http://b4.caspio.com/dp/d6a9blahblah/emb"></script> returning a console message " VM3106:22 Uncaught TypeError: Cannot set property 'innerHTML' of null". If i put the script in the console as.. document.getElementById( "elmName" ).innerHTML = '<a href="httpcodehere">Test Button</a>'; the script runs without errors and replaces the html in the <div id="elmName">Original Text</div>.I have found if I use the legacy deployment .. <script type="text/javascript" src="https://b4.caspio.com/scripts/e1.js"></script> <script type="application/javascript">try{f_cbload("d6a9blahblah","https:");}catch(v_e){;}</script> the script runs document.getElementById without errors. (I have tried running this script in other tabular report datapages deployed asynchronously all with the same error and results. Then switching them to legacy deployment and the script runs without error.) Can anyone give me any insight on why the document.getElementById will not work if the datapage is using ASYNC deployment?
  22. Good Morning, I'm using a bulk edit on a tabular search and report. I've noticed that my Cascading drop-downs in the bulk edit show blank entries when there in no data for the filed being edited in it's own table. I have a view set-up to filter out blank entries in the table being used for value purposes; however unless the field has data in its own table it still shows a blank. I found the following code for standard drop downs but haven't found any information for cascading drop downs used in the bulk edit. Hoping someone can assist with code updates. All my attempts have been unsuccessful. Thanks...Bre <SCRIPT LANGUAGE="JavaScript"> <!-- Function removeBlanksInDropdown searches for blank entries and removes all occurrences. It is advisable to use this script with the "Show distinct display options" checkbox checked in the dropdown configuration in the Caspio Bridge DataPage Wizard --> function removeBlanksInDropdown() { /* dropdown stores the value of the dropdown form element reference in the DataPage. */ var dropdown = document.getElementsByName("Value1_1"); for (var q = dropdown[0].length-1; q >= 0; q--) { if (dropdown[0].options[q].value == "") dropdown[0].remove(q); } } document.addEventListener('DataPageReady', removeBlanksInDropdown); </SCRIPT>
  23. Hi there, I have a details report datapage, where users can update information in this page. I'd like to somehow determine what has been updated every time this page is accessed, without having to list all of the fields. Caspio support suggested I do this using triggered actions, but I can't see how this is doable as there's no way to check if an element has changed, and it would mean specifying each individual field. I feel like this should be doable in JavaScript, but can't quite figure out how. My datapage reads from the table Card, but auto updates a separate table called Card_comments_and_updates, so I'd like the script to add a comma separated string to pass as a parameter listing all the field names that have changed, to this second table. Can anyone help me with this, please? TIA! Nikki
  24. I have a currency field in a table and I am using a Submission form to enter new records into that table. I want to keep users from entering a value higher than $75,000 in the currency field when using the Submission form. I also want to set a minimum value. I considered using a lookup field with fixed values, but quickly determined the min/max range is too wide ($5,000 - $75,000) because I would need to include values for $5,000.00, $5,000.01, $5,000.02 and so on, all the way up to $75,000. The answer then is using Javascript. Does anybody have the code that will match data entered into the currency field against a minimum and maximum value?
  25. Hi Guys, I am Lee Hnetinka, What are some of the best reference sites for CSS and JavaScript? Please help me
×