Jump to content

Jan

Caspio Evangelist
  • Posts

    635
  • Joined

  • Last visited

  • Days Won

    35

Posts posted by Jan

  1. Hi Cameron,

     

    I am not sure that I understand your question correctly, but maybe the following code can help:

    (you can add a Header&Footer element, select the Footer, click the Source button and enter the code)

    <SCRIPT LANGUAGE="JavaScript">
    function set_name(fieldname)
    {
    fieldname = "InsertRecord" + fieldname;
    return fieldname;
    }
    
    function set_spinner(fieldname, maxValue)
    {
    document.getElementById(fieldname).setAttribute("type", "NUMBER");
    document.getElementById(fieldname).setAttribute("min", "0");
    document.getElementById(fieldname).setAttribute("max", maxValue);
    }
    
    /* Names of fields */
    var start_hours = "start_hours";
    var start_minutes = "start_minutes";
    var end_hours = "end_hours";
    var end_minutes = "end_minutes";
    var break_hours = "break_time_hours";
    var break_minutes = "break_time_minutes";
    
    /* set spinner controls */
    set_spinner( set_name(start_hours), 23);
    set_spinner(set_name(start_minutes), 59);
    set_spinner(set_name(end_hours), 23);
    set_spinner(set_name(end_minutes), 59);
    set_spinner(set_name(break_hours), 23);
    set_spinner(set_name(break_minutes), 59);
    
    
    function calculate_hours()
    {
    /* Names of fields */
    var start_hours = "start_hours";
    var start_minutes = "start_minutes";
    var end_hours = "end_hours";
    var end_minutes = "end_minutes";
    var break_hours = "break_time_hours";
    var break_minutes = "break_time_minutes";
    
    var result = "hours";
    
    /* get values */ 
    var int_start_hours = parseFloat(document.getElementById(set_name(start_hours)).value);
    var int_start_minutes = parseFloat(document.getElementById(set_name(start_minutes)).value);
    var int_end_hours = parseFloat(document.getElementById(set_name(end_hours)).value);
    var int_end_minutes = parseFloat(document.getElementById(set_name(end_minutes)).value);
    var int_break_hours = parseFloat(document.getElementById(set_name(break_hours)).value);
    var int_break_minutes = parseFloat(document.getElementById(set_name(break_minutes)).value);
    
    /* calculate */
    var total_hours = int_end_hours - int_start_hours - int_break_hours;
    var total_minutes = int_end_minutes - int_start_minutes - int_break_minutes + total_hours*60;
    total_hours = total_minutes/60;
    
    document.getElementById(set_name(result)).value = total_hours;
    }
    
    document.getElementById("caspioform").onsubmit=calculate_hours;
    </SCRIPT>

    Please insert names of your fields instead of main in both blocks "Names of fields".

    Also I would recommend you to make all fields required, if any field will be empty, the code does not work.

     

    I hope, it helps.

  2. Hello Larry,

     

    If I understand correctly, M3:M32 means all records, then the formula finds the MAX of all records and divide it by 12. Is it correct?

    If it is correct, you can use an Aggregation.

    Yon can add an Aggregation, select you field, select the Formula option and enter the following formula:

    MAX/12

    I hope, it helps.

     

     

    Could you please elaborate on an amortization schedule? Do you want to display the whole sum that should be paid in 1 year? Or do you want to display values month by month?

  3. Hi Cameron,

     
    I had the same problem. I have used a following trick:
     
    1) For every File field:
    a) Add before the field a Virtual field, select the Checkbox Form element; on the Advanced tab, check the On load Checked by default checkbox.
    B) Copy the text of the Label of the File field to the label of the correspond Virtual field.
    c) On the Advanced tab of the File field, in the Label position dropdown, select No label.
     
    2) Go to the Rules tab, edit your rule: make all added Virtual fields required.
     
    3) Add a Header & Footer element, select the Header element, click the Source button, and enter the following code:
    <style>
    #cbParamVirtual1, #cbParamVirtual2, #cbParamVirtual3 {display:none !important;}
    #cbParamVirtual1 + span, #cbParamVirtual2 + span, #cbParamVirtual3 + span {display:none !important;}
    </style>

    I have three File fields and I have added three Virtual fields. You can add as many Virtual fields as you want, just add for every field

    , #cbParamVirtualN
    to the first line and
    , #cbParamVirtualN + span
    to the second line, where N is the number of the Virtual field.
     
    I hope it helps.
  4. Hello MostlyJava,

     

    If I understand correctly, you use two scripts that use "window.onload=function()", but the onload event happens once. In this case, only the last function executes.

     

    You can concatenate both scripts as follows:

    <script>
    window.onload=function(){
    var new_value = "AAA";
    /* change the value of the first option of the checkbox */
    document.getElementById("cbParamVirtual10").value=new_value;
    
    /* change the label text of the first option of the checkbox */
    document.getElementById("cbParamVirtual10").nextSibling.innerHTML = new_value;
    
    /* change the Virtual text field */
    document.getElementById("cbParamVirtual2").value=new_value;
    }
    </script>

    I hope, it helps.

  5. Hello MostlyJava,

     

    As far as I know, you can use the same code for the Update button (you can change the name of the link, if you want).

    I have tested it on a Single Update Form, and the Form was submitted and the data was updated.

     

    Does you have any problem with this code?

  6. Hello MostlyJava,

     

    As far as I know, the id of the first option of the Virtual1 field is "cbParamVirtual10".

    Do you want to change only the value of the option?

    You can use the next script, it changes also the label of the option:

    <script>
    window.onload=function(){
    var new_value = "AAA";
    document.getElementById("cbParamVirtual10").value=new_value;
    /* change the label text */
    document.getElementById("cbParamVirtual10").nextSibling.innerHTML = new_value;
    }
    </script>

    I hope, it helps.

  7. Hello DCT,

     

    Welcome to Caspio forum!

     

    If I understand correctly, a user clicks the Update button of a DataPage to update the value. You can edit your DataPage, and in the Destination and Emails screen select Go to a new page, and enter the logout link in the Page URL field, like

    https://eu1.caspio.com/folderlogout

     

    A user updates his or her record, and then he or she is logged out.

     

    Does it work for you?

  8. Hello Scott,

     

    Welcome to Caspio forum!

     

    As far as I know, when you select the type of join for the first relation between two tables, all other relations for these two tables will be added with this type.

    If I understand correctly, you can delete relations and create new relations with another type of join.

     

    I hope, it helps.

  9. Hello MostlyJava,

     

    Welcome to Caspio forum!

    If I understand correctly, you can use the following code:

    <script>
    window.onload=function(){
    document.getElementById("cbParamVirtual1").value="AAA";
    }
    </script>

    As far as I know, it is better to add a Header&Footer element, select the Footer element, click the "Source" button and enter the code.

    The code works, if the Virtual field is the first ("Virtual1") and if the Form element of the field is Text Field.

     

    If you could provide the URL of your page, maybe I can find the reason of the issue.

  10. Hello dwakefield,

     

    Welcome to Caspio forum!

     

    I am sorry, I do not understand your question clearly.

     

    As far as I know, a Submission Form creates a new record. A user can enter values to editable fields. A user cannot enter any value to not editable fields, like Autonumbers or fields of not editable tables of a View. Probably, it is the reason why these fields are not displayed. As far as I know, when these fields are displayed, they were disabled.

     

    Could you please tell some more details why and what you want to display on your Submission Form? Maybe I can find a solution.

  11. Hello Cameron,

     

    If I understand correctly, you can use a JavaScript code.

    Please select your "HTML Block", click the "Source" button, delete the current text and enter the following code:

    Author: [@field:author]
    <script language="javascript">
    var coauthor='[@field:coauthor]';
    if (coauthor.length>0)
    {
    coauthor = ", Coauthor: "+coauthor;
    document.write(coauthor);
    }
    </script>

    Also I would recommend you to disable AJAX on the DataPage.

    You can open the "Results Page Options" step and uncheck the "Enable AJAX" checkbox.

     

    I hope, it helps.

  12. Hello MrJason,

     

    Welcome to Caspio forum!

     

    A Details page displays the same record. So you can add a field to a table, and when the record is displayed, the value of the field is updated.

    A Submission form creates a new record. Every time when a user clicks the "Submit" button, a new record is added. So the number of records is equal the number of submissions.

     

    Does it works for you?

     

    If you want to count how many times the webpage, where the Submission Form is deployed, is displayed you can deploy the second DataPage on the same webpage.

×
×
  • Create New...