1
0
-1

Hello,

I have a form with four columns: task, concludedconcluded by and concluded on.

Considering that the concluded field is a checkbox, I want a user to tick the field every time he/she finishes a task. After that, I want the two remaining fields (concluded by and concluded on) to automatically retrieve a value, in this case, the username and the time, respectively. Is it possible?

Have in mind that the automatic values can only appear when the checkbox is selected. Also, I want to know if there's other alternative rather than creating a new section, because it will damage other formats and definitions I have in place.

Thank you for your attention.

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      hi, simple way is use section visibility control, but you do not want to create another section. So, you will need to consider the script way. Below is for your reference. You can use in Custom Html element.

      <script>
      $(document).ready(function(){
          var $checkbox = FormUtil.getField("concluded");
          $($checkbox).on("change", function(){
              var value = FormUtil.getValue("concluded");
              if (value === "yes") {
                  FormUtil.getField("concludedby").val("#currentUser.username?javascript#");
                  FormUtil.getField("concludedon").val("#date.yyyy-MM-dd HH:mm:ss?javascript#");
              } else {
                  FormUtil.getField("concludedby").val("");
                  FormUtil.getField("concludedon").val("");
              }
          })
      });
      </script>

      I am using Javascript APIHash Variablejquery in my sample script.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hello panda,

        I'm not a programmer but your solution definitely helped me reach my goal! Thanks a lot!

          CommentAdd your comment...