Jump to content

Jan

Caspio Evangelist
  • Posts

    635
  • Joined

  • Last visited

  • Days Won

    35

Jan last won the day on May 14 2022

Jan had the most liked content!

2 Followers

Recent Profile Visitors

1,963 profile views

Jan's Achievements

  1. Sudesh

    Hi Jan Please help. 

    I am new to caspio,  JS. I have a attendee checkin screen. I need to validate attendee by entering least on to the validation values to make sure the right person is checkedin. I have 3 validation values, code sent at the time of registration, mobile number and email. I have setup an update for with 3 virtual fields and modified a JS function I found on this forum to check if atleast on of the field is entered and then to check the enter field is same as on record. For some reason the fucntion never get call when I click the update button. below is the code. Really appreciate if someone can point what I am missing/doing wrong. Thanks in advance for your help.

    <script language="Javascript">

     function myFunction()
    {
         var field_code = document.getElementById("cbParamVirtual1").value;
         var field_email = document.getElementById("cbParamVirtual2").value;
         var field_phone = document.getElementById("cbParamVirtual3").value;

     if (field_code == "" && field_phone == "" && field_email == ""){
         alert("Please enter at least one verification value. Please try again.");
         return false;    } 
      else if ( field_code !== "") {
             If  (field_code !== [@field:ER_CODE]{
         alert("Attendee Code did not match. Please try again.");
         return false;                     }

      else if (field_phone !== "") {
          If  (field_phone !== [@field:Phone#]{
         alert("Attendee Phone number did not match. Please try again.");
         return false;                     } 
    }
       else if (field_email !== "") {

       if (field_email !== [@field:Email]) {
         alert("Attendee Email did not match. Please try again.");
         return false;  }
    }
    }
    document.getElementById("caspioform"). Mod0EditRecord = myFunction; 
    </script>

  2. TWIRED

    Hi Jan,

    Could use your help

     

    Im trying to change the text of a label.

    script below doesnt work.

    I can get the id , but unable to replace the text.

     

    What am I doing wrong?

     

    Ive also loaded it onLoad , so that the html loads before the script,

    but it doesnt work

    Thanks !!

     

     

    var label=document.getElementsByTagName('input')[0].id;
    alert("label value=" +label);
    document.getElementById('label').innerText = 'Change The Label Text';

    1. TWIRED

      TWIRED

      Update

      I have managed to change

      -the label of a virtual field

      -label of an  input field

      -value of an input field

       

      All I need now is help updating the value of a virtual field text box.

       

      Thanks !

  3. Hi Jan,

     

    Can you please help me.

     

    Need help with a code in a HTML blok for storing a date with extra days.

    Whats the promblem: I want to store a (date + 84 days) extra

     

    I use in my submissionform the parameter  [@Initiele_meting], this parameter [@Initiele_meting] receives on load a[@cbTimestamp*] 

    In my table the field Initiele_meting is a Date/Time field

    I want to store [@Initiele_meting] + 84 days in the table as A_Keuring is a Date/Time field.

    Why do I want it: see it like this. You are making today [@cbTimestamp*] a appointment, the deal is that you always take a action between the [@cbTimestamp*] and A_Keuring (this is the [@cbTimestamp*] + 84 days)

     

    I now have this in the footer, but dont work:

    <script>
    function grandTotal(){

    [@StartDate]=([@StartDate]+84)
    var_a =parseFloat(document.getElementById("InsertRecordEndDate").value);

    }
    </script>

    Thank you!!

    And greetz from the Netherlands.

  4. Hello Joenn, You can find an answer in the post. Please let me know, if the solution does not work.
  5. Hello Arich, Welcome to Caspio forum! You can click the Source button or disable the HTML Editor, and then paste the code. Please find instructions in the article. I hope, it helps.
  6. Hello lgohlke, Welcome to Caspio forum! It seems, that one of URL redirections is wrong. Please check the "Timeout and redirection" setting - all users, who are not logged in, are redirected by this setting. So, when a user opens a page that is assigned with an Authentication, the user is redirected to the URL that is entered to this setting. Also please verify that you use WordPress deployment and all plugins are updated to the newest version.
  7. Hello Frank, Welcome to the forum! I have written the following script. You can add a Header&Footer element, select the Footer element, click the Source button and paste the code: <script> var myTables = document.getElementsByTagName("table"); var onlyOneRecord = true; var navTable = ""; for (i=0; i<myTables.length;i++) { navTable = myTables[i].getAttribute("data-cb-name"); if((navTable=="cbFormNavigationTableTop")||(navTable=="cbFormNavigationTableBottom")) onlyOneRecord = false; } if (onlyOneRecord) document.write('<center><span class="cbFormNavigationCell cbFormNavigationMessage">Record 1 of 1</span></center>'); </script> You can change the code <center><span class="cbFormNavigationCell cbFormNavigationMessage">Record 1 of 1</span></center> as you want. I hope, it helps.
  8. Hello xtrasize, Welcome to Caspio forum! If I understand correctly, you can click the Account in the Up menu, then click "My Profile" and edit. You can find the instructions in the article. I hope, it helps.
  9. Jan

    Pivot Table View

    Hello mmorales, Welcome to Caspio Forum! As far as I know, you can define how Pivots tables are displayed in your Styles, in the Results Page - Table Layout Element. CSS is very powerful, you can do almost everything with CSS
  10. Hello cldb2016, As far as I know, any HTML code doesn't work in Calculated fields, so it's impossible to display an image in a Calculated field. But you can use a JavaScript. You can add an HTML Block, click the Source button or disable the HTML Editor and enter the following code: <SCRIPT LANGUAGE="JavaScript"> var score = '[@calcfield:5]'; score = parseFloat(score); if ((score>0)&&(score<=.5)) document.write('<img src="[@app:URL_0_5/]">'); if ((score>0.5)&&(score<=1.0)) document.write('<img src="[@app:URL_1_0/]">'); if ((score>1.0)&&(score<=1.5)) document.write('<img src="[@app:URL_1_5/]">'); if ((score>1.5)&&(score<=2.0)) document.write('<img src="[@app:URL_2_0/]">'); if ((score>2.0)&&(score<=2.5)) document.write('<img src="[@app:URL_2_5/]">'); if ((score>2.5)&&(score<=3.0)) document.write('<img src="[@app:URL_3_0/]">'); if ((score>3.0)&&(score<=3.5)) document.write('<img src="[@app:URL_3_5/]">'); if ((score>3.5)&&(score<=4.0)) document.write('<img src="[@app:URL_4_0/]">'); if ((score>4.0)&&(score<=4.5)) document.write('<img src="[@app:URL_4_5/]">'); if ((score>4.5)&&(score<=5.0)) document.write('<img src="[@app:URL_5_0/]">'); if ((score>5.0)||(score<=0)) document.write('<img src="[@app:URL_11_0/]">'); </SCRIPT> I hope, it works
  11. Hi skauntey, Is it a Submission form? If I understand correctly, virtual field and a listbox are placed on the same Datapage, where the AutoSubmit script is placed, is it correct? And if the parameter will be like "one,second,third" - does it work for you? Sorry for many questions, but there are too many variants of answers.
  12. Hello adfga, Welcome to Caspio forum! You can deploy two or three DataPages on your webpage, for example, you can read this article or see this video. You can add the following script to the Footer (please do not forget to click the Source button): <SCRIPT LANGUAGE="JavaScript"> function check_field() { var fieldname = "integer"; var max = 10; var min = 1; var myMessage = "Enetered value should be more then 0 and less then 11"; fieldname = "InsertRecord" + fieldname; var intmyValue = 0; var myValue = document.getElementById(fieldname).value; if (myValue.length > 0) intmyValue = parseFloat(myValue); else intmyValue = 0; if ((intmyValue>max)||(intmyValue<min)) { alert(myMessage); return false; } } document.getElementById("caspioform").onsubmit=check_field; </SCRIPT> Please, enter the name of your field instead of "integer"; enter your values of max, min and message. I hope, it helps.
  13. Hello IPV, Welcome to Caspio forum! If I understand correctly, you have one field that stores values. So, you can Select the Hidden FormElement for the field that stores values. Add a Virtual field, select the "Checkbox" element and enter your values, for example, "Math", to "Display Text" and "Value when checked" fields. Add as many virtual fields as you want. Add Header&Footer element, select the Footer element, click the Source button and enter the following script: (please enter the name of your field that stores values instead of "text"; enter the numbers of first and last Virtual fields in the group of checkboxes, in my case the first one is VirtualField1 and the last one is VirtualField3) <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var Resultfieldname = "text"; var firstVirtual = 1; var lastVirtual = 3; var ResultString = ""; var virtualFieldName = ""; for (i=firstVirtual ;i<=lastVirtual; i++) { virtualFieldName = "cbParamVirtual"+i; if (document.getElementById(virtualFieldName).checked) ResultString = ResultString + "," + document.getElementById(virtualFieldName).value; } Resultfieldname = "InsertRecord"+Resultfieldname; if (ResultString.length>0) ResultString = ResultString.substr(1); document.getElementById(Resultfieldname ).value = ResultString; } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT> If you have more than one block, you can add blocks like: (please enter the name of your second field that stores values instead of "new"; enter the numbers of first and last Virtual fields in the second group of checkboxes, in my case the first one is VirtualField4 and the last one is VirtualField6) Resultfieldname = "new"; firstVirtual = 4; lastVirtual = 6; ResultString = ""; virtualFieldName = ""; for (i=firstVirtual ;i<=lastVirtual; i++) { virtualFieldName = "cbParamVirtual"+i; if (document.getElementById(virtualFieldName).checked) ResultString = ResultString + "," + document.getElementById(virtualFieldName).value; } Resultfieldname = "InsertRecord"+Resultfieldname; if (ResultString.length>0) ResultString = ResultString.substr(1); document.getElementById(Resultfieldname ).value = ResultString; Then the whole script will be like: <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var Resultfieldname = "text"; var firstVirtual = 1; var lastVirtual = 3; var ResultString = ""; var virtualFieldName = ""; for (i=firstVirtual ;i<=lastVirtual; i++) { virtualFieldName = "cbParamVirtual"+i; if (document.getElementById(virtualFieldName).checked) ResultString = ResultString + "," + document.getElementById(virtualFieldName).value; } Resultfieldname = "InsertRecord"+Resultfieldname; if (ResultString.length>0) ResultString = ResultString.substr(1); document.getElementById(Resultfieldname ).value = ResultString; //second block Resultfieldname = "new"; firstVirtual = 4; lastVirtual = 6; ResultString = ""; virtualFieldName = ""; for (i=firstVirtual ;i<=lastVirtual; i++) { virtualFieldName = "cbParamVirtual"+i; if (document.getElementById(virtualFieldName).checked) ResultString = ResultString + "," + document.getElementById(virtualFieldName).value; } Resultfieldname = "InsertRecord"+Resultfieldname; if (ResultString.length>0) ResultString = ResultString.substr(1); document.getElementById(Resultfieldname ).value = ResultString; } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT> I hope, it helps. Please feel free to ask if anything is unclear.
  14. Hello cldb2016, Welcome to Caspio forum! If I understand correctly, you can find instructions how to work with fields on DataPages in the article. I have edited your code a bit: <SCRIPT LANGUAGE="JavaScript"> function rewriteMobileNumber() { var mobilenumber = document.getElementById("InsertRecordmobilenumber").value; var mobilenumberten = mobilenumber.substring(2); document.getElementById("InsertRecordmobilenumbereight").value = mobilenumberten; } document.getElementById("caspioform").onsubmit=rewriteMobileNumber; </SCRIPT> I hope, it works now.
  15. Hi Cameron, You can follow the steps: On the Search screen, select the date field, click "add a field", select "New Criteria". Select the field again, in the "Logical operator between criteria" field, select "AND". Select Criteria 1, in the "Comparison type", select "Greater than or equal". Select Criteria 2, in the "Form element" field, select "Hidden"; in the "Comparison type", select "Greater than or equal". Add the Header&Footer element, select Footer, click the Source button or disable HTML Editor and enter the following code: <SCRIPT LANGUAGE="JavaScript"> function setDate() { number_of_the_field = 1; numberDays = 7; var fieldname1 = "Value"+number_of_the_field+"_1"; var fieldname2 = "Value"+number_of_the_field+"_2"; var stringDate = document.getElementById(fieldname1).value; var myDate = new Date(Date.parse(stringDate)); myDate.setDate(myDate.getDate()+numberDays); var myMonth = myDate.getMonth() + 1; if (myMonth<10) {myMonth = "0" + myMonth;} var myDay = myDate.getDate(); if (myDay<10) {myDay = "0" + myDay;} var myYear = myDate.getFullYear(); var result = myMonth + "/" + myDay + "/" + myYear; document.getElementById(fieldname2).value=result; } document.getElementById("caspioform").onsubmit=setDate; </SCRIPT> number_of_the_field - is the order number of the field on the page. If it's the first page, than enter "1". numberDays - enter the number of days that should be added. I hope, it helps.
×
×
  • Create New...