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

Discussion

Discussion

Set value of built in LF Comments field with JS

posted on November 10, 2020

I have a textarea field that currently takes on the user comments for a particular step. I have hidden the built in Comments field, but I would like to copy the value entered in #q73 textarea to the built in comments field so that it will display in the Action History tab. Can this be done?

 

I have tried the following JS:

$('#q73').on('change', function () {
    //alert('73 changed');
    $('#comments').val($('#q73').val());
  });

The change trigger alert is firing, but the value does not display in the comments box. I have temporarily unhidden it to test. Is there something else preventing this?

0 0
replied on November 10, 2020 Show version history

It looks like you're targeting the parent element rather than the input. Try this:

$('#Field73').on('change', function () {
    //alert('73 changed');
    $('#comments').val($('#Field73').val());
});

Or this if you prefer

$('#q73 textarea').on('change', function () {
    //alert('73 changed');
    $('#comments').val($('#q73 textarea').val());
});

 

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

Sign in to reply to this post.