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

Question

Question

changing Text Above Field and/or Text Below Field

asked on October 12, 2021

Hello all,

in an attempt to save space, in my form I have a lookup rule that populates a single line with an employee's number. I want to know what to add to the code below so that employees name populates into the "Text below field" box of the same single line variable.  here is what I have:

The employee name info from the lookup is "FullName"

If this is even possible, any help would be appreciated.

Thanks.

0 0

Replies

replied on October 12, 2021

You'll have to create a hidden field that also populates from your lookup rule with the employee name. Then in that "not sure what goes here" just set the value of the help text to the value of the hidden field.

 

I would also consider running the JavaScript on the hiddenfieldID.change not on the budge number field, if you run into issues with it catching the change, you can just run on a setTimeout of like 600 milliseconds.

 

Note: If you have multiple steps to your form, you should hide the employee name field in field rules but set the dropdown to save the data in there unless you'll run the look up rule on every step of the form.

0 0
replied on October 12, 2021

Thanks Sergey!

0 0
replied on October 13, 2021

Sergey, 

I'm sorry but I can't figure this out probably because I'm new at coding in LF.  I have tried numerous changes to the "$helptext." line and still can't make it work:

I show the "Text Below Field" as subLabel and the "Text Above Field" as textHelp when I inspect the form. The Badge Number" field is #q2/Field2. when a person enters their badge #, their name is populated into #q11/Field11. The variable for that field is "Name"

Any more help with this would be appreciated very much.

Donnie

0 0
replied on October 13, 2021 Show version history
$(document).ready(function(){

  $("#q11").change(function(){
  	$("#q2 .cf-helptext").text($("#Field11").val());
  });

});

I was able to get it working by setting the .text to the value of the hidden field. You can try this and test it if your form routes to others to make sure that .text set holds. You may have to play around with it some more to get it to hold throughout the form process.

 

Edit: This worked for me because I had a default sample text already in the bottom of that field and javascript changed what was there. If you do not set something in that field by default, Forms may not draw that at all in the dom in which case you would not be able to set/change the text with javascript.

0 0
replied on October 13, 2021

Sergey,

I see how you made it work by adding text in the field (either one).  It will do for what we want.  Thanks so much for your help!

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

Sign in to reply to this post.