You are viewing limited content. For full access, please sign in.

Question

Question

Need java inernal variables to get text from the comments forms

asked on December 10, 2014

I would like to get this

{/dataset/_submitter_displayname}, {/dataset/_comment}, {/dataset/_submission_time}, {/dataset/_action}

But to add it in the forms at each step of the process in a multi-line fields.

So I figure to do with java script by using an hidden multi-line filed and put these variables as default. but the issue is it works only once, at the submission step, after that it become static and does not update at each step

So here the code I used but what I needs is the equivalent of these variables to use them in the java section

#q132 is a summary of all the comments and #q133 is the hidden comments with the variables in default

but the result is not what I want

$(document).ready(function () {
  var com = $('#q132 textarea').val();
  var com2 = $('#q133 textarea').val();
   
//  if (com2 > "0"){
  com = com + '\n\n' + com2;
  $('#q132 textarea').val(com);   
//}
  $('#q132 textarea').attr('readonly', 'True');
});

 

1 0

Answer

SELECTED ANSWER
replied on December 14, 2014

The sample I provided before is just a sample to show that you can get comment from different steps and combine them together. If you want get other information as well as comment, you can use similar method. For example, you can add separate single line fields and set their default value as {/dataset/_submitter_displayname}/{/dataset/_submission_time}/{/dataset/_action} and hide them on the form, and then use following script to get the default value and display together in a multiline field:

$(document).ready(function () {
  var com = $('#q2 textarea').val();
//get previous comment
  var com2 = $('#q1 textarea')[0].getAttribute('default-val');
//get previous action participant
  var displayname=$('#q3 input')[0].getAttribute('default-val');
//get previous submission time
  var submissiontime=$('#q4 input')[0].getAttribute('default-val');
//get previous action
  var action=$('#q5 input')[0].getAttribute('default-val');
//combine the information together
  var currentinfo=""; 
  if(displayname!=null){
        currentinfo=displayname+", ";
      }
  if(com2!=null){
        currentinfo=currentinfo+com2+", ";
      }
  if(submissiontime!=null){
        currentinfo=currentinfo+submissiontime+", ";
      }
  if(action!=null){
        currentinfo=currentinfo+action;
      }
//append to field that display the information
if (currentinfo!=""){
  com = com + '\n\n' + currentinfo;
  $('#q2 textarea').val(com);   
}
  $('#q2 textarea').attr('readonly', 'True');
});

 

2 0

Replies

replied on December 10, 2014

0 0
replied on December 10, 2014

the idea is to get each comments from all the participant during the forms process till the end , and these comments will be also saved in a PDF forms file to permit someone later to understand what has happen with the credit request process.

0 0
replied on December 12, 2014

Are you use same form for different steps or different form for different steps? I tested to use same for form 4 user tasks and use following JavaScript to only display the comment, and it works for me

$(document).ready(function () {
  var com = $('#q2 textarea').val();
  var com2 = $('#q1 textarea')[0].getAttribute('default-val');
   
if (com2!=null){
  com = com + '\n\n' + com2;
  $('#q2 textarea').val(com);   
}
  $('#q2 textarea').attr('readonly', 'True');
});

The screenshots is the comment summary in user task 4:

0 0
replied on December 12, 2014 Show version history

I use different forms (modification from the first form, to put some field in read only)

I need to get in the comment , the previous step submitter name, the date of the action done , the action name and the comment put in the Forms application and not the comment put in the form itself.

 

Well I grab the first comment from the forms itself because when you start the form you do not have a comment box, So I add one for the Credit Requester and after I want to use the comment box that is added by the application with also the name of the person that do that step with the date of the action done.

So I need to get the Java equivalent variable of this internal form variable {/dataset/_submitter_displayname}, {/dataset/_comment}, {/dataset/_submission_time}, {/dataset/_action}

0 0
SELECTED ANSWER
replied on December 14, 2014

The sample I provided before is just a sample to show that you can get comment from different steps and combine them together. If you want get other information as well as comment, you can use similar method. For example, you can add separate single line fields and set their default value as {/dataset/_submitter_displayname}/{/dataset/_submission_time}/{/dataset/_action} and hide them on the form, and then use following script to get the default value and display together in a multiline field:

$(document).ready(function () {
  var com = $('#q2 textarea').val();
//get previous comment
  var com2 = $('#q1 textarea')[0].getAttribute('default-val');
//get previous action participant
  var displayname=$('#q3 input')[0].getAttribute('default-val');
//get previous submission time
  var submissiontime=$('#q4 input')[0].getAttribute('default-val');
//get previous action
  var action=$('#q5 input')[0].getAttribute('default-val');
//combine the information together
  var currentinfo=""; 
  if(displayname!=null){
        currentinfo=displayname+", ";
      }
  if(com2!=null){
        currentinfo=currentinfo+com2+", ";
      }
  if(submissiontime!=null){
        currentinfo=currentinfo+submissiontime+", ";
      }
  if(action!=null){
        currentinfo=currentinfo+action;
      }
//append to field that display the information
if (currentinfo!=""){
  com = com + '\n\n' + currentinfo;
  $('#q2 textarea').val(com);   
}
  $('#q2 textarea').attr('readonly', 'True');
});

 

2 0
replied on February 16, 2015

In place to use a comment Inside the form, I would like to use the one that it is add automatically by forms and appends this comment to a field name sumary comment.

what is the variable of the default form comment that it is added with form and not create by using a text field. look in my sample image, there is a field named comments but also another one that is added by the forms system.

So I would like to get the value of this comment forms system field and append the info on the created comments field in the next approval business step

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.