Jump to content

Search the Community

Showing results for tags 'javascript'.

  • 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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Website URL






  1. ababcock

    Time Sheet

    I have multiple submission forms that need to calculate total hours based on the begin time and end time entered. The script I have entered is: <script> document.getElementById('Submit').onmouseover = function(){ var date = document.getElementById('InsertRecordDate_of_Service').value; if(date == "") date = "1/1/2011"; var hour = document.getElementById('cbParamVirtual2').value; if(hour =="") hour="00"; var minute = document.getElementById('cbParamVirtual3').value; if(minute == "") minute = "00"; var ampm = document.getElementById('cbParamVirtual4').value; document.getElementById('InsertRecordStart_Time').value = date + " " + hour + ":" + minute + " " + ampm; var hour2 = document.getElementById('cbParamVirtual6').value; if(hour2 =="") hour2="00"; var minute2 = document.getElementById('cbParamVirtual8').value; if(minute2 == "") minute2 = "00"; var ampm2 = document.getElementById('cbParamVirtual7').value; document.getElementById('InsertRecordEnd_Time').value = date + " " + hour2 + ":" + minute2 + " " + ampm2; var start= new Date(document.getElementById('InsertRecordStart_Time').value); var end = new Date(document.getElementById('InsertRecordEnd_Time').value); var timeDiff = end - start; var hh = Math.floor(timeDiff / 1000 / 60 / 60); timeDiff -= hh * 1000 * 60 * 60; var mm = Math.floor(timeDiff / 1000 / 60); var totalmin= (mm+ (hh * 60)) ; document.getElementById('InsertRecordTotal_Units').value = totalmin.toFixed(2); }; </script> This is working some of the time, but not always, and I don't know what the problem is. I just submitted a record for 6/9/15 11:00 AM to 6/9/15 2:00 PM, and it came up with 185.00 hours. Does anyone know a way to make this work?
  2. Hi there, In the App I am currently developing I have a "View Inventory" DataPage where my users can see (for a chosen product) what the starting inventory was A, how many units are reserved / shipped B and finally how many units are available C. C is a calculated field where C = A - B On this page I also have an HTML block with a control button that my users can click to create a shipment request, but I want this to be disabled when C = 0 because as it stands right now, there is nothing stopping them from ordering an item that is out of stock. The current code for my button is as follows: '<div style="margin: 10px;"><a href="http://eu1.caspio.com/dp.asp?AppKey=cde830001d57b1a237854adab459&Stock_ID=[@field:Stock_ID]&Product_Description=[@field:Product_Description]" style="background: rgb(61, 130, 171); padding: 7px 20px; border: 1px solid rgb(221, 221, 221); border-image: none; color: rgb(255, 255, 255); font-weight: bold; text-decoration: none; white-space: nowrap;">Create Shipment Request</a></div>' I read on another post on here that the way to address this was to use Javascript, so following that advice I changed the code for my button the the following: <script type="text/javascript"> var cb_boolean = '[@calcfield:1]'; if (cb_boolean != '0') { document.write("<input type='button' value='Create Shipment Request' Name='mybutton' onclick='myfunction()'> "); } else { document.write("<input type='button' value='Out Of Stock!' Name='mybutton' disabled=true>"); } function myfunction() { window.location.href='http://eu1.caspio.com/dp.asp?AppKey=cde830001d57b1a237854adab459&Stock_ID=[@field:Stock_ID]&Product_Description=[@field:Product_Description]'; } </script> This worked in terms of disabling my button where C = 0, but then the parameters were no longer being passed to my shipment request DataPage. I suspect this is a syntax error of some sort, but being a newbie to the worlds of both HTML and Javascript I just don't know what I need to change. Any advice would be much appreciated Thanks
  3. Hello All, Does anyone have any tricks or scripts to prevent copy/paste and right click on a DataPage. I understand that most scripts may be browser dependent, but just looking to make it a bit more difficult for users to copy things. Thanks in advance
  4. Hello Caspio Ninjas! I've noticed when the page scrolls down the Hint Popup moves an equal distance down from the element producing the hint. When scrolled down more than a few lines the Hint popup moves all the way off the screen. I just tested it in a "preview" mode, and noticed that it only happens on embedded Data Pages. I removed all of my javascript for testing, and it didn't fix it. I even removed all markup except the script for a DataPage Where would i begin trying to diagnose this problem? What might be affecting the Caspio Hint popup from my page? Thanks
  5. Hello Everyone! I have found some great answers on this forum for most of my issues but cannot find anything regarding this specific question I have. sincerely appreciate any offers of help. Currently I have a DataPage which outputs 5 text fields with a calender popup next to each (see attached img). I would like to select a date via the popup in the first field and have the subsequent fields all populate with the next day. So if you select 2/19/2015 then the output in the next data field is 2/19/2015 and so on. I believe that I can do this via some custom JS if I need to, but I wasn't sure if Caspio Bridge can help me do so automatically through a selection in the "Web Form Wizard- Configure Fields". I appreciate you checking out my post and any help you can offer! Cheers, Dilts
  6. Hi All, Can anyone please provide a JavaScript to do the following as I have tried rules and I can’t seem to get it to work. I have a record in a data page that contains fields d1 to d10 (these are date fields) and fields et1 to et10 (hidden fields). If an authenticated user amends d1 then I want his/her username to be stored in et1. If an authenticated user amends d2 then I want his/her username to be stored in et2. If an authenticated user amends d3 then I want his/her username to be stored in et3. If an authenticated user amends d4 then I want his/her username to be stored in et4. If an authenticated user amends d5 then I want his/her username to be stored in et5. If an authenticated user amends d6 then I want his/her username to be stored in et6. If an authenticated user amends d7 then I want his/her username to be stored in et7. If an authenticated user amends d8 then I want his/her username to be stored in et8. If an authenticated user amends d9 then I want his/her username to be stored in et9. If an authenticated user amends d10 then I want his/her username to be stored in et10. Regards Pearse
  7. Hello all, I am currently working on a search form (using a virtual field submission form) that has a dropdown menu to select from predefined reports. The way I would like this to function is that when the user selects an option (such as "Recent (Within the Last 10 Days)") an onchange function would change the search fields to the input needed to produce those results. I am fairly new to JavaScript, here is what I have been able to get: <SCRIPT LANGUAGE="JavaScript"> function ocPredefinedReports() { if (document.getElementById("cbParamVirtual8").value=='Recent (Within the last 10 days)') { document.getElementById("cbParamVirtual5").value= 'Doe'; } } document.getElementById("cbParamVirtual8").onchange=ocPredefinedReports;</script>​ Through Google-Fu I was able to get a function working at one point that gave me ten days ago (Unfortunately I didn't save it anywhere!) but it was in the wrong format entirely. Any and all help is much appreciated, thank you. -Blue Edit: Sorry about the terrible title, time for more coffee.
  8. Good afternoon, I am attempting to use the Javascript posted in the solutions to combine fields. In my case I have three fields I am looking to combine. Employee_First_Name, Employee_Last_Name, and Employee_ID. The ideal formatting of this would be Lastname, Firstname - EmployeeID (For Example Smith, John - 111111) Here is the script I have that is not currently combining the fields let alone getting into the details of formatting. This is being deployed in a submission datapage. <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var Employee_First_Name = document.getElementById("InsertRecordEmployee_First_Name").value; var Employee_Last_Name = document.getElementById("InsertRecordEmployee_Last_Name").value; var Employee_ID = document.getElementById("InsertRecordEmployee_ID").value; var Employee_Selector = Employee_Last_Name + Employee_First_Name + Employee_ID; document.getElementById("InsertRecordEmployee_Selector").value = Employee_Selector; } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT> Thank you for your time!
  9. Hi, I have some script in the table that I need to be able to run on my DataPage. Can I do that? Thanks.
  10. Hi, I'm new to Caspio. I have a 9 date text fields with calendar picker. When user picks date for 1st field I need the subsequent 8 fields to populate with the 1st field's date + 1 business day. The result would be as follows: field 1 - 01/16/2015 SELECTED field 2 - 01/19/2015 AUTOPOPULATED field 3 - 01/20/2015 AUTOPOPULATED field 4 - 01/21/2015 AUTOPOPULATED field 5 - 01/22/2015 AUTOPOPULATED field 6 - 01/23/2015 AUTOPOPULATED field 7 - 01/26/2015 AUTOPOPULATED field 8 - 01/27/2015 AUTOPOPULATED field 9 - 01/28/2015 AUTOPOPULATED THEN SUBMIT* Any help, javascript and/or implementation would be greatly appreciated. Thanks.
  11. I have a Single Record Update form where once a user has submitted data on Record #123, I want any other users subsequently trying to update Record #123 to be "locked out" from submitting via that form. In other words, I need to be able to disable a form after it's been used once, or when Some_Field = Whatever. You could just disable it with Rules, but if 2 people arrive on the form before either has submitted, then the 2nd User rewrites over the 1st User's data. I need to prevent that from happening. Caspio Support recommends: In order to prevent the next users to submit/edit the same record, the "timestamp check" should be done upon form submission. A solution would be to write a JavaScript function to perform the "timestamp check" and then call the function on the form submission event. Can anyone please assist with this? I'm JavaScript illiterate. Thanks!
  12. Hi, I have a form with 3 checkboxes. A visitor can select any checkbox to get the products they want: newspaper or magazine, both, or just one. --- The visitor can also select to get the e-newsletter, but only if the newspaper checkbox is selected. Else the e-newsletter checkbox is disabled (which is a rule set configured in the form that works fine). What I need.. is a function for if someone chooses both "newspaper" and "e-newsletter" checkboxes then decides that they don't want "newspaper" and deselect it (which leaves e-newsletter still checked). I need an onchange function that unchecks the "e-newsletter" checkbox at the exact same time newspaper is unchecked. Note - The exisitng rule makes the checkbox disabled and enabled, but it doesn't uncheck it. SAMPLE OF FORM: 1) [ ] Get this free newspaper /--> OC_news_print = id 1b) [ ] Get the e-newsletter too /--> OC_news_eletter = id 2) [ ] Get this different magazine -- SOMETHING LIKE CODE BELOW IS NEEDED - MINE / IT DOESN'T WORK --- <! -- vars NEEDED AT ALL ? var ocPrint = document.getElementById("InsertRecordOC_news_print"); var ocEnews = document.getElementById("InsertRecordOC_news_eletter"); --> function ocProductsCheck() { if (document.getElementById('InsertRecordOC_news_print').checked.length<1) { document.getElementById("InsertRecordOC_news_eletter").checked=false; } else { if (document.getElementById('InsertRecordOC_news_print').checked.length>0) { document.getElementById("InsertRecordOC_news_eletter").checked=false; } } document.getElementById("InsertRecordOC_news_print").onchange=ocProductsCheck; Thanks - Geoff
  13. Hello All! I am trying to figure out how to refresh an iframe from a popup window. I can do it when the popup is called from the main page (ADDing records), but I can't figure it out for a popup that is called from within the iframe (EDITing records). In addition to residing within an iframe the button to call the EDIT popup is a Caspio Data Page and is built from javascript during page load. Please consider the following scenario. (I removed classes, titles, and other irrelevant items for simplicity) Main Page: <div id="vehicles"> <div class="frmHeader"> <h2>Vehicles</h2> <a onclick="popupWindow('addVehicle.html')"></a><!-- ADD vehicle --> <a onclick="ifrRefresh('ifrVehicle')"></a> </div> <iframe src="lic/vehicle.html" name="ifrVehicle" id="ifrVehicle"></iframe> </div> Iframe Content html file: <div id="ifrContentVehicle" class="ifrContent killHeader"> <script src="/scripts/e1.js"></script> <script>try{f_cbload("***","http:");}catch(v_e){;}</script> </div> Iframe Content after load: <div id="ifrContentVehicle" class="ifrContent killHeader"> <form id="caspioform"> <div> <table name="cbTable"> <tbody> <tr> <td> <a onclick="popupWindow('editVehicle.html?VehicleID=*')"></a><!--EDITv--> ... Add Vehicle: <script> window.onunload = refreshParent; function refreshParent() { window.opener.ifrVehicle.location.reload(); } </script> This works to refresh my iframe named ifrVehicle. However, I cannot get it to work with the Edit popup. Any help will be greatly appreciated! CHAD
  14. Hi, I used two forum articles to get pretty far in fixing what Facebook sees on a details page that Caspio creates. Could you help me fix this so that specific product details are shown in the Facebook URL preview? I added a script based on Jan's suggestions in these articles and I need help to correct the javascript. http://forums.caspio.com/index.php/topic/4148-fieldsparameters-in-browser-tabs/?hl=%2Bpage+%2Btitle http://forums.caspio.com/index.php/topic/4297-facebook-open-graph-meta-tags/?hl=facebook When I add a caspio-related details page URL into a Facebook status, it automatically puts gobbledy gook instead of the content that I am trying to specify with OG code. Shown here: http://prntscr.com/5jxrw9 Page title Click here to load this Caspio online database. Click here to load this Caspio online database. Click here to load this Caspio online database. Click here to load this Caspio online database. Click here to load this Caspio online database. Click here to load this Caspio online database. From what I can tell, this is because of the embedded code when I use the Wordpress Caspio plugin. It looks like one of the problems is that Facebook believes it knows my canonical URL and is not looking at the product ID parameter to see what OG data is there. I want the data to be specific to each product page and not be generic. Here is what I put in the Header data page element. How can this be fixed? I don't see how to modify the Facebook OG code to conform to Jan's javascript provided. (https://developers.facebook.com/docs/payments/product) <style type="text/css"> #Mod0EditRecord, #Mod0CancelRecord{ display: none; } </style> <SCRIPT LANGUAGE="JavaScript"> window.onload= function() { document.title ="[@field:product_NAME] | [@field:product_MANUFACTURERorig] | Adjectivs"; head prefix= "og: fb: product: http://ogp.me/ns/product#" og:title ="[@field:product_NAME] | [@fild:product_MANUFACTURERorig] | Adjectivs"; og:type ="product"; fb:app_id ="259344627418443": og:url ="http://adjectivs.com/product-details-caspio/?product_Product_UID=[@field:product_Product_UID] />; og:image ="[@field:product_IMAGEURL]"; } </SCRIPT>
  15. I have a Reports-Details datapage and want to access some of the field values that are not on the associated html page (so I can't do, e.g., document.getElementById). Since there are a lot of fields I want to access at once, I'd rather not type out each one individually. So instead of alert('[@field:field1_name]'); alert('[@field:field2_name]'); ... alert('[@field:field100_name]'); I want to loop through an array of the field names like this var a = ["field1", "field2", ... , "field100"]; a.forEach(function(element) { alert('[@field:' + element + '_name]'); });
  16. I have a submission form with a couple of checkboxes. Ideally, it would be mandatory for one of the two checkboxes to be selected. However, my primary concern is that both checkboxes cannot be selected so I want to toggle off one when the other is checked. I have been playing around with other javascript code I have found on the Caspio forum but have not had any success getting it modified and working. Following is my attempted code on two checkboxes, one named "pure" and the other "mix". Any help for a javascript newcomer would be appreciated... <script type="text/javascript"> /* Get value of the Yes/No fields */ var cb_pure = '[@field:pure]'; var cb_mix = '[@field:mix]'; if (cb_pure == 'Yes') { /* make sure cb_mix is deselected */ document.getElementById("InsertRecordmix").checked=false; } if (cb_mix == 'Yes') { /* make sure cb_pure is deselected */ document.getElementById("InsertRecordpure").checked=false; } </script>
  17. I have a text field with id=TextField. When the user types 10 into this field I would like the font color of 10 to change immediately to red (and if possible change the background color of the text field). It seems the best way to do this is change the CSS style of TextField when 10 is entered into this field. I searched online but couldn't get any of the available code to work. Thanks.
  18. Does anyone have a javascript that would insert the <li> tag at the beginning of each sentence entered into a text box? I am looking to get bullet points formatted on print view for multiple sentences entered into a text box.
  19. Hi. I need to collect data from several different drop-downs, then combine the results into a single array in my data table. How would I do that? Example: If I collect 5 as the value for dropdown_1, and 3 for the value of dropdown_2, and 4 for the value of dropdown_3, I would need to be able to use that to create an array in another field (dropdown_values) such as: 5, 3, 4 I'm guessing this is a javascript thing. Any idea how to do that? Thanks for any help.
  20. I have a form that currently uses Dropdowns and want to change them to Radio buttons. Not a biggie, but I'm not sure what I need to change on my script to make it work. It seems that the radio button has 2 fields, so I think I have to somehow choose which is selected? I'm a bit of a novice, so any help would be greatly appreciated. Here is my current script: <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_q1 = parseFloat(document.getElementById("InsertRecordSec1Q1").value); var v_q2 = parseFloat(document.getElementById("InsertRecordSec1Q2").value); var v_q3 = parseFloat(document.getElementById("InsertRecordSec1Q3").value); var v_q4 = parseFloat(document.getElementById("InsertRecordSec1Q4").value); var v_q5 = parseFloat(document.getElementById("InsertRecordSec1Q5").value); var v_q6 = parseFloat(document.getElementById("InsertRecordSec1Q6").value); var v_Sec1total = (v_q1+v_q2+v_q3+v_q4+v_q5+v_q6); document.getElementById("InsertRecordSec1TotalScore").value = Math.round(v_Sec1total);
  21. Need help in disabling the Enter Key from a text area in a Submission Form and an Update Form. Since I later on use that parameter to pass it on to another form and if the user used the Enter key, this passing of parameters results in an error. This is what I have on the header of the submission form but still is not working: <script language="javascript" type="text/javascript"> function stopRKey(evt) { var evt = (evt) ? evt : ((event) ? event : null); var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if ((evt.keyCode == 13) && (node.type=="text")) { return false; } } document.onkeypress = stopRKey; </script> The field I want to prevent is named as: "[@Status_trial]" I will greatly appreciate the Help!
  22. Hello I have two fields in my submission form - date and day. The customer selects date (via calendar pop up text field). I need the day field to automatically be populated by the day of the week from the date input (so someone inputs 25/12/2013 and the day field automatically says 'Wednesday' or whatever). Currently, I'm tackling this in a very roundabout way, by passing a long date to a report data page and then using rules (if date contains 'Monday' then hide section 1 etc). This is laborious and requires the user to click again on a url link. There must be an easier way. Does anyone know how? Ideally some javascript to just take the day of the week from the date field would be good. If that's not possible, then javascript that basically says "if [@field:date] contains 'Monday' then go to data page XXXXXXX" All help appreciated. Thanks Duncan
  23. Hello I'm a bit of a Caspio newbie and pretty unskilled (ok - very unskilled!) at Javascript. I have a couple of, hopefully small, issues that I assume I need some basic javascript to solve. I've tried adapting code that I've found elsewhere, but I don't really know what I'm doing:- 1.I have a field called 'maximum_people' and one called 'no_of_people'. I need to restrict the number of bookings received on a given date, so if I create a report datapage (filtering by date) I need to add up all the 'no_of_people' submissions, and then have the form stop if it >='maximum people'. I suppose I need something like- <script> if(SUM[@field:no_of_people] <[@field:maximum_people]) { document.write("<a href='http://b6.caspio.com/dp.asp?AppKey=504f20004a6cefd06ad94881b12c&Course_ID=[@field:Course_ID]'>Signup</a>"); } else { document.write("<p>Signup Closed</p>") } </script> 2.)The second thing is a simple block to ensure that no bookings are made before today (as the Caspio calendar allows any date to be selected, even in the past)- I guess it is sort of like- <script> if([@field:date] >="today") { document.write("<a href='http://b6.caspio.com/dp.asp?AppKey=504f20004a6cefd06ad94881b12c&Course_ID=[@field:Course_ID]'>Signup</a>"); } else { document.write("<p>Sorry, we can only take bookings from tomorrow onwards</p>") } </script> I'm flying blind though, and there are probably 101 better ways to achieve what I need. Hopefully someone can help... Duncan
  • Create New...