Jump to content

Johnny

Members
  • Content Count

    3
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Thanks
    Johnny reacted to deemuss in Set condition to Yes/No field   
    It is possible to set checkmark condition using Calculated Value.
    The field should be set as Calculated Value
    The basic formula to set the condition is: CASE WHEN [@field:IntegerValue]=100 THEN 'X' ELSE 'Y' END  
    For Yes/No field, the boolean value us 1/0. However, to make it work properly, the field should receive BIT value. So, CAST function should be applied:
     
    CASE WHEN [@field:IntegerValue]=100 THEN CAST(1 as bit) ELSE CAST(0 as bit) END  
  2. Thanks
    Johnny got a reaction from CoopperBackpack in How to receive the value from the field to the HTML block   
    Hi @CoopperBackpack
    Hope you are well.
    Here is the code that would let you to achieve the result. You should insert it in your HTML block.  And I will explain the code below. Please be aware, that I used Virtual Field for this example with name "cbParamVirtual1" as a Calculated Value, since in Caspio  virtual field has syntax [@cbParamVirtual1].  You can put there your own field name if needed instead of "cbParamVirtual1"
    <div class="message"></div> <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { document.querySelector('input[id*="cbParamVirtual1"]').addEventListener("change", myFunction); function myFunction(event) { let virField = event.target.value; document.querySelector('.message').innerHTML = "your text should be here " + virField; document.removeEventListener('DataPageReady', myFunction); } }); </script>  
    This is the part where you insert text, added by JS code::
    <div class="message"></div>  
    The JS code has place, where you should enter the text you want to have in HTML block.  Here is this part, replace "your text should be here " for the one you need.
    document.querySelector('.message').innerHTML = "your text should be here " + virField;  
    Hope it helps.
     
    Regards,
    Johnny
×
×
  • Create New...