Jump to content

Jan

Caspio Evangelist
  • Posts

    635
  • Joined

  • Last visited

  • Days Won

    35

Posts posted by Jan

  1. 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.

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

  3. 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 :)

  4. 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.

  5. Hello IPV,

     

    Welcome to Caspio forum!

     

    If I understand correctly, you have one field that stores values.

    So, you can

    1. Select the Hidden FormElement for the field that stores values.
    2. 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.
    3. 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.

  6. 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.

  7. Hi Cameron,

     

    You can follow the steps:

    1. On the Search screen, select the date field, click "add a field", select "New Criteria".
    2. Select the field again, in the "Logical operator between criteria" field, select "AND".
    3. Select Criteria 1, in the "Comparison type",  select "Greater than or equal".
    4. Select Criteria 2, in the "Form element" field, select "Hidden"; in the "Comparison type",  select "Greater than or equal".
    5. 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.

  8. Hello ababcock,

     

    As far as I know, DataPages are designed with tables, and every field is placed in a cell, or something like this.

    So, if you add your table and your cells, the design is broken.

     

    Maybe, you can use a standard HTML form and use it with Caspio?

     

    Or you can use a standard features of Caspio and CSS to display fields like a "table". I mean, you can apply "border="1" style="width:100%"" to the table with name "cbTable" or better with attribute

    data-cb-name="cbTable"

  9. Hello Elena,

     

    You can add the following code to the header:

    <style>
    #target table:nth-of-type(1) th:nth-of-type(3) {color: red;}
    #target table:nth-of-type(1) td:nth-of-type(3) {color: red;}
    </style>
    <div id="target">

    And the following code to the footer:

    </div>

    3 in the "th:nth-of-type(3)" and in the "td:nth-of-type(3)" is the number of column.

    th:nth-of-type{} defines the style of the header,

    td:nth-of-type{} defines the style of records.

    You can add as many columns as you want.

     

    If the code does not work, you can try changing the number in "table:nth-of-type(1)" - to "2", or to "3".

     

    I hope, it helps.

  10. Hi,

     

    I am almost did it :) Maybe, someone can help me with the last step.

     

    Steps:

    Create three DataPages:

    • Tabular DataPage that uses the table A as the DataSource;
    • Submission DataPage that uses the table B as the DataSource;
    • Details DataPage, that uses the table A as the DataSource.
    1. On Tabular DataPage, add the HTML Block, disable HTML Editor and enter the code:
      <a href="URL_where_Submission_DP_is_deployed?id=[@field:id]&name=[@field:name]&surname=[@field:surname]&comment=[@field:comment]">Delete</a>
      You can enter the correct URL and use as many fields as you want. The "Id" field is a field with unique value.
    2. On Submission DataPage,
      add Header and Footer element, disable HTML editor for Header and Footer, enter the following code to the Header:
      <div align="center"> <p>Processing...</p> <img src="images/progress_bar.gif" alt="Progress Bar" width="200" height="15" /> </div>
      And the following code to the Footer:
      <script type="text/javascript">
        if(document.getElementById("caspioform")) {
        document.getElementById("caspioform").style.display = 'none';
        setTimeout('document.forms["caspioform"].submit()',1000); }
      </script>

      Check for all fields "On load: Receive value or parameter" and select the "External parameter"
      Add a Virtual field, check for them "On load: Receive value or parameter", select the "External parameter" and the name of your Id parameter; check "On exit:Pass field value as parameter".
      On the Specify options to be performed after form submission screen, select "Go to a new page' and enter the URL of the page, where the third DataPage is deployed.

    3. On Details DataPage,
      in the "Do you need an interactive Search Form or pre-defined criteria?" screen, select "Filter data based on your pre-defined criteria";
      in the "Choose the fields you intend to use in filtering data" screen, add the "id" field to the Selected fields;
      in the "Configure the filtering criteria for each selected field" screen, on the Advacned tab, check "On load: Receive value or parameter", select the "External parameter" and the name of your Id parameter;
      in the next screen, add Header and Footer element, disable HTML editor for the Footer, enter the following code to the Footer:

      <script type="text/javascript">
        if(document.getElementById("caspioform")) {
        setTimeout('document.getElementById("Mod0DeleteRecord").click();',1000);}
      </script>

      in the next screen, check the "Delete record";
      in the next screen, in the "Destination after record delete" select "Go to a new page" and enter the URL of th first DataPage.

    Now, when a user clicks the "Delete" link in the HTML blank, fields are copied to table B, and a user should confirm the deletion on the Details page. If the user confirms, the first DataPage opens.

     

    I am sorry, if the solution is too complex.

  11. You can open the Details DataPage in another tab. Then a user can close the tab and see the Result page.

    You can add the following setting to your link to open the Deatils page in a new tab:

    target="_blank"

    And you can read more about the setting in the article.

     

    Does it work for you?

  12. Christopher,

     

    As far as I know, if two Authentications use the same table as an Authentication table, and Auto-login is checked in both Authentications, then a user log in only one time and can go through both Authentications.

    Does it work for you?

     

    Or I can try to write a code that will display the expire time and maybe show some alert message, if time is less than a minute. I have several ideas but I need time to check if they work.

  13. Hi ccarls3,

     

    If I understand correctly, you have a DataPage, where you don't want to log out user after time out.

    You can create the copy of your Authentication, assign it with the DataPage and set maximal value for time out setting. You also need to check the "Enable auto-login" in both Authentications.

    Does it work for you?

×
×
  • Create New...