Read in text from list item and place it in form text box

  • 23 October 2017
  • 5 replies
  • 15 views

Badge +6

Greetings,

 

I have a task form that I'm working on.  I have a list of standard comments that a user can have for a response in a list called canned responses.  I want to be able to load into the text box on the form the selected canned response and allow the user to just approve/deny with that canned response of if needed edit the response a bit to fit their needs.

 

Is there a way to load in a list item (multiple lines of text) into a form text field?

 

I can go with just a single response now, but I would like to make it so that the user would have a drop down of response titles; ie;

Approve standard response

Approve please review ticket

Approve dates are changed

Deny standard response

Deny Other reason

 

each of the titles above would have another column that has the actual multiple lines of text corresponding to the response title.  The form text field would then fill in with the corresponding response text and the user could accept it as is or edit it for their needs.

 

Thanks for your help


5 replies

Badge +6

Hello, I did find the solution here : https://walkingthestack.com/2013/11/18/lookup/

It got me very close.  I now have the data in a calculated field using the lookup function, but I want to be able to allow the user to edit the field if needed.  It does not seem like the calculated field allows that.  Is there a way to copy the data from my calculated field into my task list's comment field?

Thanks

Badge +6

Hello All,

I found someones javascript example online but it does not give details.  Perhaps someone can shed some light on how I should configure this.

The field I wish to fill in on my form is called "Comment"  (this is the task list comment field)

The calculated field Name that will have the data is called "ResponseText"

The calculated field formula is : lookup("ECC Letter", "ID", ResponseTitles, "Letter")

The new example calculated field looks like:

UpdateTextBox(<Existing formula>)

The example javascript from online looks like: (* what is inpval? *Is TextBox in the example my Comment field?)

function UpdateTextBox(inpval){
   NWF$('#'+TextBox).val(inpval);
   return inpval;
}

Therefore my new calculated field looks like:
UpdateComment(lookup("ECC Letter", "ID", ResponseTitles, "Letter"))

the javascript (this is where I am probably messing up) looks like:
function UpdateComment(ResponseText){
   NWF$('#'+Comment).val(ResponseText);
   return ResponseText;
}
*  I just get errors when previewing...


Thanks for helping
Badge +6

I've updated my javascript to look like :

function UpdateComment(value){
   var ResponseText;
   NWF$('#'+ResponseText).val(value);
   return value;
}

No errors, but nothing happens. 

Userlevel 5
Badge +14

I've never done anything like his, but intermediate calculation value control doesn't seem to me to be necessary.

I would say something like this should do it directly.

NWF.FormFiller.Events.RegisterAfterReady(function () {
    NWF$('#' + jsvarResponeTitles).change(function(evt){
        NWF.RuntimeFunctions.SPLookup("ECC Letter", "ID",NWF.RuntimeFunctions.parseLookup(evt.target.value,false),'Letter').done(function(data){
             NWF$('#' + jsvarComments).val(data);
             NWF.FormFiller.Functions.ProcessOnChange(NWF$('#' + jsvarComments));  
        });
    });
});


Badge +3

Did this solution work for the question? I have a very similar requirement being proposed to me and this could possibly be what I am looking for. I basically need a set of buttons on the form (dynamically displayed based on a previous field's selection) that when clicked would populate a guide template into a multiple lines of text field to help them fill in the appropriate information.

This solution looks like it would be about 75% of the way there if it works!

Reply