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

Question

Question

Add Field Value to Text Above Field

asked on August 14, 2019

Hello,

What I am trying to do is take the value's in a field on form load and copy it to the text above the field for all fields on the form. The reason I'm trying to do this is so that our HR department can view the originally submitted information and the final edited information on the document that gets saved to the repository without me having to duplicate every field or save an "original" copy of the form and an "edited" copy of the form.

 

I have gotten this to work for Single Line, Drop-Down, and Multi-Line fields but not Radio Buttons or Checkbox. Here is the code I'm using - does anyone have any suggestions on how I can make this work for Radio Buttons and Checkboxes too?

 

$(document).ready(function() {
   $('label.cf-helptext.ab-help').each(function() {
		$(this).append(' ' + $(this).next().val());
    });
});

 

Additionally, if anyone knows how toggle on the text above field via jquery instead of having to manually add a default value for each field to get it added to DOM?

0 0

Answer

SELECTED ANSWER
replied on August 22, 2019

This code will work but it won't transfer to a secondary form in the process.

 

(document).ready(function() {

  var fields = $(".cf-field");


   fields.each(function(index) {
     $(this).append($(this).find("input[checked='true'],input.singleline,select,textarea").map(function() {
        return $(this).val()}).get().join() + ' ');
    });
});

 

0 0

Replies

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

Sign in to reply to this post.