Jump to content
Sign in to follow this  
RickManolo

Add text field entry to a text area

Recommended Posts

I have a submission form with a text field (AddNote) and a text area (Notes) that is 'Display Only" in the form.

I need JS that will take an entry in the AddNote field and add it to entries already in the Notes text area upon submitting the form.

My attempts all lead to the text field entry replacing the pre-existing text area data.

Share this post


Link to post
Share on other sites

Hi @RickManolo,

Well, for me the easiest way to do this is to use a Virtual field to display "Notes" and make an actual field "Notes" as hidden.

I assume that you use Single Record Update or Details Datapage. 

If the answer for above is yes, you can use the following JS code to concat existing Note with AddNote input after Update of the record.

<script type="text/javascript">
document.addEventListener('BeforeFormSubmit', function (event) {

        let target = document.querySelector('[id*="EditRecordNotes"]');
        let n_notes = document.querySelector('input[id*="EditRecordAdd_Note"]').value;
        let o_notes = document.querySelector('input[name*="cbParamVirtual1"]').value;

        target.value = o_notes + n_notes;

});
</script>

Change the name of the fields if necessary, and also make sure you disable HTML editor prior to pasting the code.

Hope this helps.

Regards,

vitalikssssss 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...