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

  1. 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>
  2. 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?
  3. 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
  4. 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?
  5. 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>
  6. 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
  7. 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?
  8. Hi Guys, I am Lee Hnetinka, What are some of the best reference sites for CSS and JavaScript? Please help me
  9. 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
  10. Good day. I have a display where I use the Totals & Aggregation Count function to total records. I would like to only display the rows where the total is greater that 1. Caspio expert session indicates that this can be done via Javascript. Any help would be much appreciated, thank you. Colin Hancox
  11. 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
  12. 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>
  13. 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?
  14. 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
  15. 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
  16. Hellow everyone, I have implemented a sign in form an button in html: <ons-button onclick="login()">Sign in</ons-button> The following Javascript is as follows: var token_ var userName = "clientID"; var passWord = "secretKey"; // app clientSecret var caspioTokenUrl = "https://xxx123.caspio.com/oauth/token"; var request = new XMLHttpRequest(); function getToken(url, clientID, clientSecret) { var key; request.open("POST", url, true); request.setRequestHeader("Content-type", "application/json"); request.send("grant_type=client_credentials&client_id="+clientID+"&"+"client_secret="+clientSecret); // specify the credentials to receive the token on request request.onreadystatechange = function () { if (request.readyState == request.DONE) { var response = request.responseText; var obj = JSON.parse(response); key = obj.access_token; //store the value of the accesstoken token_ = key; } } } getToken(caspioTokenUrl, userName, passWord); var login = function CallWebAPI() { var params {"ClientID" : "username", "ClientSecret" : "password"}; var request_ = new XMLHttpRequest(params); request_.open("GET", "https://xxx123.caspio.com/rest/v1/tables", true); request_.setRequestHeader("Authorization", "Bearer "+ token_); request_.send(); request_.onreadystatechange = function () { if (request_.readyState == 4 && request_.readyState == 200) { var response = request_.responseText; var obj = JSON.parse(response); } } } It still does not work for me and I'm not quite sure what I am doing wrong. Any help is very much appreciated! Thank you all!
  17. 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?
  18. 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.
  19. 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.
  20. 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>
  21. 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
  22. 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
  23. 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???
  24. kimburlyz

    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!
  25. 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
×