Jump to content

Jan

Caspio Evangelist
  • Posts

    635
  • Joined

  • Last visited

  • Days Won

    35

Posts posted by Jan

  1. Hello pgjacob,

     

    If I understand correctly, there are two misprints in the code:

     

    var v_totalreghr  = (v_reghr * v_ regpay);

    document.getElementById("InsertRecordPayroll_journal_Regular_Pay").value = (v_ totalreghr).toFixed(2);

     

    Spaces break the code.

     

    And, if you use a Virtual field, the id of Virtual field is "cbParamVirtual1" (you can see more details about Ids and Names).

     

    I hope, it helps.

  2. Hello Cameron,

     

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

     

    If you want to filter only by the "previous month" filter:

    1) On the "Search Type" step, select "Allow users to select data using a search form";

    2) On the "Select Search Fields" step, add your field with date;

    3) On the "Configure Search Fields" step,

    - select your field with date, select the "Month and Year" in the "Precision" dropdown;

    - add Header&Footer element, select "Footer", click the "Source" button and enter the following code:

    <SCRIPT LANGUAGE="JavaScript">
    if(document.getElementById("caspioform"))
    {
      document.getElementById("caspioform").style.display = 'none';
       var nDate = new Date();
       var baseMonth = nDate.getMonth();
       var nPreviousMonth = baseMonth - 1;
       var dPreviousMonth = new Date (nDate.setMonth(nPreviousMonth));
       var searchMonth = dPreviousMonth.getMonth() + 1;
       if (searchMonth<10) {searchMonth  = "0" + searchMonth; }
       var searchYear = dPreviousMonth.getFullYear();
       var searchString = searchMonth + "/" +  searchYear;
       document.getElementById("Value1_1").value=searchString;
      setTimeout('document.forms["caspioform"].submit()',1000);
    }
    </SCRIPT>

    The code enters previous month in the Search field and clicks "Search" button. User does not see the Search page, he or she sees Results page.

     

    If you want to filter by other fields,

    1) On the "Search Type" step, select "Allow users to select data using a search form";

    2) On the "Select Search Fields" step, add fields;

    3) On the "Configure Search Fields" step,

    - select your field with date, move it up to the first position, select "Hidden" in the "Form element" dropdown, select the "Month and Year" in the "Precision" dropdown;

    - add Header&Footer element, select "Footer", click the "Source" button and enter the following code:

    <SCRIPT LANGUAGE="JavaScript">
    if(document.getElementById("caspioform"))
    {
       var nDate = new Date();
       var baseMonth = nDate.getMonth();
       var nPreviousMonth = baseMonth - 1;
       var dPreviousMonth = new Date (nDate.setMonth(nPreviousMonth));
       var searchMonth = dPreviousMonth.getMonth() + 1;
       if (searchMonth<10) {searchMonth  = "0" + searchMonth; }
       var searchYear = dPreviousMonth.getFullYear();
       var searchString = searchMonth + "/" +  searchYear;
       document.getElementById("Value1_1").value=searchString;
    }
    </SCRIPT>

    The code enters previous month as one of search criteria.

     

    Does it work for you?

  3. Hi zalipresents,

     

    I have tried your code and it works.

    I have added an HTML Block, click the "Source" button and entered your code. On click, a new window opens.

     

    To format the displaying, you can:

    1) When you insert the field with a Parameter Picker, select the "Yes/No" format instead of "String". Then the code will be

    [@field:Announced^]

    2) Edit the Localization, that is assigned with the DataPage (or copy your Localization),

    select "Formatting Standards",

    select "Yes/No",

    check "Enable Custom Yes/No Formatting",

    select "custom",

    enter "Y" and "*NO*".

    I have attached the screenshot.

     

    I hope, it helps.

    post-15260-0-44499500-1433223190_thumb.p

  4. Hi,

     

    What type of a DataPage do you use? If it is a Submission Form, I think, you can use the following code:

    <SCRIPT LANGUAGE="JavaScript">
    
    function fillSecondField()
    {
    document.getElementById("InsertRecordField2").value = document.getElementById("InsertRecordField1").value;
    }
    
    document.getElementById("InsertRecordField1").onchange=fillSecondField;
    </SCRIPT>

    Please enter names of your fields instead of Field1 and Field2.

     

    I hope, it helps.

  5. Hi,

     

    I have one more idea, but I am not sure that it is a good idea :)

    You can add fields to your tables with names of your parameters. These fields are not used anywhere, they are not displayed on any page. But if the name of a parameter is the same as the name of the field (even if the field is not used on the page), then parameter is not cleared after refreshing.

     

    I hope, it makes sense.

  6. Hi Phil,

     

    It is strange, that there is no "Right" option in Label position. I never think about it, but now it is strange :)

     

    You can try the following steps:

    1) On the "DataPage Data Source" step, enable "Advanced options" and "Parameters".

    2) After every Text field, add a Virtual field.

    3) For Virtual fields, select the "Display Only" Form Element; on the Advanced tab, check "On load: Receive value or parameter", select the "Default value" and enter the text of your label.

    4) For Text Fields, on the Advanced tab, check the "Continue next element on the same line".

    5 and last) For Text Fields and Virtual Fields select "No Label" for "Label position".

     

    Now Virtual fields are displayed as "Labels" to the right of Text Fields.

     

    I hope, it helps :)

  7. If I understand correctly, now the following code is used:

     

    <script language="JavaScript">

    function calculate()
    {
       var v_one= parseFloat (document.getElementById("InsertRecordCrate_One_Quantity").value);
       var v_two= parseFloat (document.getElementById("InsertRecordCrate_Two_Quantity").value);
       var v_three= parseFloat (document.getElementById("InsertRecordCrate_Three_Quantity").value);
       var v_total  = v_one + v_two + v_three;
       document.getElementByID(“InsertRecordTTL_Cratesâ€).value= v_total; } document.getElementById("caspioform").onsubmit=calculate;
    </script>
     
    There are two misprints in the following line
    document.getElementByID(“InsertRecordTTL_Cratesâ€).value= v_total; } 
    Incorrect quotes and "ID"
     
    You can try to change the line as follows:
    document.getElementById("InsertRecordTTL_Crates").value= v_total; }

    I hope, it helps.

×
×
  • Create New...