Jump to content


Caspio Ninja
  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by lmooring

  1. Hi, I have a simply one that I just can not figure out. I know it's easy but I haven't been able to get this to work.

    I have a field where the user will enter a date. I want to take that date and add one, then insert into another field on a submission form.


    Field Name: End Date (user entered) = 10/23/2017

    Field Name: Expire Date (calculated) = 10/24/2017


    Any help would be appreciated.

  2. 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 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;


  3. I need to create an alert on a submission form where,


    If the drop down box PACKTYPE is = "Simple" then if text field SIMPLEUNIT not equal to 1

    Else if PACKTYPE is = "Complex" then a second text field COMPLEXUNITS must be =<2 or greater than 1, which ever is easier.


    I would like to include alert messages if possible. I am not sure how to write this. I am sure it is simple but I am not familiar enough and not in submission forms. I've only seen items for reports.


    Any help is appreciated!

  4. Hi Twired, 


    I don't know that I am javascript savvy enough to get this into my form. I updated the scripts above to distinct function names, so I have checkCOST and checkMOQ. Based on my understanding of the articles you gave I added :<form onsubmit="return ((checkCOST() & checkMOQ()) == 1)"> to my footer but I am not able to get anything to work. I did determine that the third script "f_vendorstyle" was acting correctly and was not required in the onsubmit validation.


    Any additional assistance or guidance would be most appreciated.

  5. Hi! I have multiple scripts for a submission page. When I execute the page I am only able to get one to work at a time. Not all three. I am not sure what I am doing wrong. Any help or advice would be appreciated. I have pasted the scripts below. I have all the scripts in the footer of the page.

    The first simply checks that the MOQ field is greater than the Inner Pack field.

    The second checks that cost is less than retail.

    They third, if the virtual check box is checked, it will copy the data from the Vendor VPN field to the Vendor Style field.

    <SCRIPT LANGUAGE="JavaScript">
     function check()
       var v_moq = parseFloat(document.getElementById("InsertRecordMOQ").value);
     var v_innerpack = parseFloat(document.getElementById("InsertRecordINNERPACK").value);
    if(v_moq<v_innerpack) {
         window.alert("MOQ Must Be Less Than The Inner Pack");
     return false;
    <SCRIPT LANGUAGE="JavaScript">
     function check()
       var v_cost = parseFloat(document.getElementById("InsertRecordCOST").value);
     var v_retail = parseFloat(document.getElementById("InsertRecordRETAIL").value);
    if(v_cost>v_retail) {
         window.alert("Vendor Cost must be less than Retail");
     return false;
    function f_vendorstyle()
    } else {
    document.getElementById('cbParamVirtual1').onclick= f_vendorstyle;


  6. I found this scripting that might be helpful. I am uncertain how to translate this for Caspio.


    function checkEan(eanCode) {
    	// Check if only digits
    	var ValidChars = "0123456789";
    	for (i = 0; i < eanCode.length; i++) { 
    		digit = eanCode.charAt(i); 
    		if (ValidChars.indexOf(digit) == -1) {
    			return false;
    	// Add five 0 if the code has only 8 digits
    	if (eanCode.length == 8 ) {
    		eanCode = "00000" + eanCode;
    	// Check for 13 digits otherwise
    	else if (eanCode.length != 13) {
    		return false;
    	// Get the check number
    	originalCheck = eanCode.substring(eanCode.length - 1);
    	eanCode = eanCode.substring(0, eanCode.length - 1);
    	// Add even numbers together
    	even = Number(eanCode.charAt(1)) + 
    	       Number(eanCode.charAt(3)) + 
    	       Number(eanCode.charAt(5)) + 
    	       Number(eanCode.charAt(7)) + 
    	       Number(eanCode.charAt(9)) + 
    	// Multiply this result by 3
    	even *= 3;
    	// Add odd numbers together
    	odd = Number(eanCode.charAt(0)) + 
    	      Number(eanCode.charAt(2)) + 
    	      Number(eanCode.charAt(4)) + 
    	      Number(eanCode.charAt(6)) + 
    	      Number(eanCode.charAt(8)) + 
    	// Add two totals together
    	total = even + odd;
    	// Calculate the checksum
        // Divide total by 10 and store the remainder
        checksum = total % 10;
        // If result is not 0 then take away 10
        if (checksum != 0) {
            checksum = 10 - checksum;
    	// Return the result
    	if (checksum != originalCheck) {
    		return false;
        return true;


    Source: http://www.logikdev.com/2010/05/13/validate-your-ean-barcode/

  7. I am building an item entry form where the user will need to submit a products corresponding UPC (11 or 12 digit upc) with the check digit. I am looking for a way, in caspio, to verify that the check digit is correct. 

    For example, to calculate the check digit for UPC 82546692620

    1. I will take the sum of all the odd position digits (8+5+6+9+6+0=34)
    2. I will multiply the sum by 3 (34 * 3 = 102)
    3. I will take the sum of all the even position digits (2+5+6+2+2=16)
    4. I will add the result of step 2 with step 3 (102+16=118)
    5. I will divide the sum of step 4 by 10 (118/10=11.8 or 11 remainder 8)
    6. I will take the remainder of step 5 and subtract from 10 (10-8=2)
    7. The resulting check digit for 82546692620 is 2


    I have two fields that the user will populate - UPC and UPC Check Digit. I would need to calculate the result above and ensure it is equal to the check digit entered by the user. If not equal, the form should not submit.

    Any assistance would be most appreciated and helpful.

  8. Hi Xiang,


    Sorry for the delay. I have been out of the office on a trip. I will explain how the page works and the expected results:


    The store enters all submission information (subname, store# and store name) these fields are not linked to the script.

    The store selects the vendor name and enters the invoice number. The store then enters the total amount of the invoice in the invoice amount field.


    The store then needs to select the type of order that was placed. If the store selects "Donation" or "Store Expense" the only other action required is to attach the invoice and submit. There are no corresponding register transactions for these two options and thus the fields remain inactive. The script to check the total of register transactions to invoice amount should not run. Register transactions will always = 0.00 in this case.


    If the store selects "Pass Thru" the register transaction fields become active and the store is required to enter the transaction information. This is when the script should run to check that the total of the transactions entered is equal to the invoice amount entered in the previous Invoice Amount field.

    The store then attached the invoice and clicks submit. If the balance is equal the invoice amount the form will submit if not they will get an error message to correct.


    Thank you for your continued assistance with this.

  9. Oh sorry about that and thank you for letting me know. I have copy and pasted the existing script below:



    <!-- JAVASCRIPTING -->
    <!-- Calculation script -->
    <SCRIPT LANGUAGE="JavaScript">
     function calculate()
       /* Retrieve the value of the field Transaction_Total and store in a variable 'v_trans' */
       var v_trans = parseFloat(document.getElementById("InsertRecordVInvoice1Amount").value);
       /* Retrieve the value of the field Invoice1 and store in a variable 'v_invoice1' */
       var v_invoice1 = parseFloat(document.getElementById("InsertRecordTTotal1").value);
       /* Retrieve the value of the field Invoice2 and store in a variable 'v_invoice2' */
       var v_invoice2 = parseFloat(document.getElementById("InsertRecordTTotal2").value);
       /* Retrieve the value of the field Invoice3 and store in a variable 'v_invoice3' */
       var v_invoice3 = parseFloat(document.getElementById("InsertRecordTTotal3").value);
       /* Retrieve the value of the field Invoice4 and store in a variable 'v_invoice4' */
       var v_invoice4 = parseFloat(document.getElementById("InsertRecordTTotal4").value);
       /* Retrieve the value of the field Invoice5 and store in a variable 'v_invoice5' */
       var v_invoice5 = parseFloat(document.getElementById("InsertRecordTTotal5").value);
       /* Retrieve the value of the field Invoice6 and store in a variable 'v_invoice6' */
       var v_invoice6 = parseFloat(document.getElementById("InsertRecordTTotal6").value);
       /* Retrieve the value of the field Invoice7 and store in a variable 'v_invoice7' */
       var v_invoice7 = parseFloat(document.getElementById("InsertRecordTTotal7").value);
       /* Retrieve the value of the field Invoice8 and store in a variable 'v_invoice8' */
       var v_invoice8 = parseFloat(document.getElementById("InsertRecordTTotal8").value);
       /* Retrieve the value of the field Invoice9 and store in a variable 'v_invoice9' */
       var v_invoice9 = parseFloat(document.getElementById("InsertRecordTTotal9").value);
       /* Retrieve the value of the field Invoice10 and store in a variable 'v_invoice10' */
       var v_invoice10 = parseFloat(document.getElementById("InsertRecordTTotal10").value);
       /* Retrieve the value of the field Invoice11 and store in a variable 'v_invoice11' */
       var v_invoice11 = parseFloat(document.getElementById("InsertRecordTTotal11").value);
       /* Retrieve the value of the field Invoice12 and store in a variable 'v_invoice12' */
       var v_invoice12 = parseFloat(document.getElementById("InsertRecordTTotal12").value);
       /* Retrieve the value of the field Invoice13 and store in a variable 'v_invoice13' */
       var v_invoice13 = parseFloat(document.getElementById("InsertRecordTTotal13").value);
       /* Retrieve the value of the field Invoice14 and store in a variable 'v_invoice14' */
       var v_invoice14 = parseFloat(document.getElementById("InsertRecordTTotal14").value);
       /* Retrieve the value of the field Invoice15 and store in a variable 'v_invoice15' */
       var v_invoice15 = parseFloat(document.getElementById("InsertRecordTTotal15").value);
       /* Add all invoices and freight charged and store in variable v_invtotal */
       var v_invtotal = (v_invoice1 + v_invoice2 + v_invoice3 + v_invoice4 + v_invoice5 + v_invoice6 + v_invoice7 + v_invoice8 + v_invoice9 + v_invoice10 + v_invoice11 + v_invoice12 + v_invoice13 + v_invoice14 + v_invoice15);
       /*Check if v_invtotal = v_trans*/
       if ( v_invtotal == v_trans)
            /* Insert a  value of the variable v_invtotal into the DataPage field Invoice_Total */
            document.getElementById("InsertRecordTotalTransaction").value = v_invtotal;
            alert('Invoice Total does not equal Transaction Totals. Please re-enter values');
     /* On submitting the webform, the function calculate is executed */
  10. I have this existing java script that does a check to see that the net of the invoices entered is equal to the transaction amount entered.


    I would like to add a condition that this should only execute if the order type is equal to "Pass Thru".

    Pass Thru is one of three options on a radio button field.


    Your assistance would be much appreciated!


    I have attached the existing java script below.

  • Create New...