1
0
-1

Hi there,

I have created a button to auto-generate the number of rows predefined by user into form grid.  I do checked there's a sample script - Add a new Row in Form Grid using script from Knowledge Base, anyhow I am not sure how to call it from my button, is it using onClick event?  

Would appreciate your advise.  Many thanks ahead.

Regards,

Wah Man

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi, based on the sample script, it think you first need to make it a function first as following, how to trigger this function is based on how and when you want the function is call.

      function addRow() {
          // the field id is "entries"
          var field = FormUtil.getField("entries");
          var functionName = window[field.attr("id") + "_add"];
          if(typeof functionName === 'function') {
              var args = new Object();
              args['result'] = '{"amount":"1","category":"Medical","claim":"","purpose":"a","date":"11/18/2015","formattedAmount":"$ 1.00"}';
              functionName(args);
          }
      }
        CommentAdd your comment...