Jump to content

GoCubbies

Caspio Ninja
  • Posts

    82
  • Joined

  • Last visited

  • Days Won

    11

Community Answers

  1. GoCubbies's post in Label Color, Field Color was marked as the answer   
    Hello,
    I added the tag direct in the label under General Options.

  2. GoCubbies's post in Javascript Formatting Disappears On Page 2 Of Results Etc was marked as the answer   
    Hello,
     
    I would recommend disabling AJAX on the Results Page Options of the DataPage Wizard.
  3. GoCubbies's post in Uk Localization Is Not Supported For Date Format Dd/mm/yyyy? was marked as the answer   
    Yes, this feature certainly  needs to be implemented.
    In the meantime, I have a simple script for you to make this work.
     
    <SCRIPT LANGUAGE="JavaScript">
    document.getElementById("InsertRecordsecond").parentNode.parentNode.style.display = 'none';
     
    function checkStart()
    {
    var enteredValue = document.getElementById("InsertRecordfirst").value;
    var formatday = enteredValue.search("/")+1;
    var textday = enteredValue.substring(0,formatday);
    var monthyear = enteredValue.substring(formatday);
    var formatmonth = monthyear.search("/")+1;
    var textmonth = monthyear.substring(0,formatmonth);
    var onlyyear = monthyear.substring(formatmonth);
    enteredValue = textmonth + textday + onlyyear;
     
    var enteredDate = new Date(enteredValue);
    var ruleDate = new Date();
    ruleDate.setDate(26);
    ruleDate.setMonth(8);
    ruleDate.setFullYear(2014);
    ruleDate.setHours(0);
    ruleDate.setMinutes(0);
    ruleDate.setSeconds(0);
       if (enteredDate<ruleDate)
          {
             document.getElementById("InsertRecordsecond").parentNode.parentNode.style.display = 'none';
           }
    else
    {
             document.getElementById("InsertRecordsecond").parentNode.parentNode.style.display = '';
           }
    }  
     
    document.getElementById("InsertRecordfirst").onchange=checkStart;
    </SCRIPT>
     
    The code hides the “InsertRecordsecond†field.
    When the “InsertRecordfirst†field is changed, if the date from the “InsertRecordfirst†field is more than ruleDate, the “InsertRecordsecond†field is displayed, else it is hidden.
    A user can enter his/her day = setDate(26), month, January is 0 = setMonth(8), year = setFullYear(2014).
    There are also Hours, Minutes, Seconds, if it is required.
  4. GoCubbies's post in Calculated Grand Total Field In Submission Form was marked as the answer   
    Liz,
     
    Are you looking to have this calculation done on submission or on some other type of action before it is submitted?
     
    Here is an example that I hope gets you started.  As a note, the invoice_total field will need to be a form element text field and hidden using the method found in http://howto.caspio.com/tech-tips-and-articles/common-customizations/how-to-hide-fields-in-datapages/
     
    <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("InsertRecordTransaction_Total").value);

       /* Retrieve the value of the field Invoice1 and store in a variable 'v_invoice1' */
       var v_invoice1 = parseFloat(document.getElementById("InsertRecordInvoice1").value);

       /* Retrieve the value of the field Invoice2 and store in a variable 'v_invoice2' */
       var v_invoice2 = parseFloat(document.getElementById("InsertRecordInvoice2").value);

       /* Retrieve the value of the field Invoice3 and store in a variable 'v_invoice3' */
       var v_invoice3 = parseFloat(document.getElementById("InsertRecordInvoice3").value);

       /* Retrieve the value of the field Invoice4 and store in a variable 'v_invoice4' */
       var v_invoice4 = parseFloat(document.getElementById("InsertRecordInvoice4").value);

       /* Retrieve the value of the field Invoice5 and store in a variable 'v_invoice5' */
       var v_invoice5 = parseFloat(document.getElementById("InsertRecordInvoice5").value);

       /* Retrieve the value of the field Freight_charged and store in a variable 'v_freight' */
       var v_freight = parseFloat(document.getElementById("InsertRecordFreight_charged").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_freight;
      
       /*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("InsertRecordInvoice_Total").value = v_invtotal;
       }
       else
       {
           
            alert('Transaction Total does not equal values entered. Please re-enter values');
           
       }
     }

     /* On submitting the webform, the function calculate is executed */
     document.getElementById("caspioform").onsubmit=calculate;

    </SCRIPT>
×
×
  • Create New...