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

Question

Question

forms set CustomHTML text through lookup rule

asked on February 26, 2019

I want to set the text of a CustomHTML using a Field Lookup rule.  Is this possible?  If so, how?

0 0

Replies

replied on February 26, 2019

I don't think it is possible out-of-the-box, but you could do it with some JavaScript.

  1. Create a span or some other element with a set ID attribute
  2. Create hidden field to store the lookup value
  3. Attach a change event handler to the hidden field
  4. On change, update the contents of the element with the value of the field

 

Depending on when the data is retrieved, it is also worth noting that variables with saved values can be used in the Custom HTML. Default variables like current user are available at the start, but your custom variables wouldn't be available until they were populated in a previous submission/task.

0 0
replied on February 26, 2019

I tried this before I posted my Question and the .change event on the hidden field triggers before the text of the hidden field actually gets updated.

0 0
replied on February 26, 2019 Show version history

It should still trigger again once the text is populated. I do this exact thing all the time, so something else must be happening.

The easiest way to test would be to just log the field text to the console every time the event fires; that way you can see the exact sequence.

1 0
replied on February 26, 2019

Also note that depending on how you plan on using the data, you could have it populate a multiline text field and make the field read-only. It will show a little differently than a Custom HTML field, but usually serves it purpose.

0 0
replied on February 26, 2019

Thanks for the suggestion, but since I do not know how long or short the actual text will be, it would be hard to use the multiline field that has a predefined size.  The CustomHTML field will grow as needed.

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

Sign in to reply to this post.