Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confiforms display excerpt of textarea fields in tableview - or inline search on hidden fields

We have a form with a textarea field and a tableview with inline search for this form. As the content of the textarea field has to be searchable, we included it in the tableview. The length of the text increases the line height so that we would like to 

- show only an excerpt in table view OR

- exclude this field from table view 

but still the field content should be searchable in the view. 

Is that even possible? 

1 answer

Yes, you can use trim/trunc or even truncWithExpand functions to limit the number of characters shown in the field

https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

 

fieldname.truncWithExpand(100)

 Shows first 100 symbols from a field "fieldname"

Please be careful when you truncating the field's value which may have HTML as it may produce a broken output (truncating HTML contents so that it becomes not valid)

You might need to consider using "extractText" first

fieldname.extractText.truncWithExpand(100)

Hi Alex,

I have just tried the function 

fieldname.truncWithExpand(100)

 in the Confiforms Field macro. But I am getting the below result on my page in the Table View: 

st test test test st test test test test test st test test test test testst test test test test test <span id='sah7squ1lp' class='sah7squ1lp_c'><a href='#sah7squ1lp' onclick='cfExpandDetails("sah7squ1lp");return false;'>...</a></span><span class='sah7squ1lp_e' style='display:none'> st test test test st test test test test test st test test test test testst test test test test test </span> 

Apparently, the code is inserted correctly, but the page doesn't compile it.

What could I be doing wrong?

  • I am using Table view -> Confiforms Form Field -> in the Confiforms Field macro configuration, under "Field", I have entered myfield.truncWithExpand(100)

Thanks!

Well, the function "truncWithExpand(N)" is really not something to use with an HTML contents, as it truncates the characters... and can potentially cut your HTML contents in a very bad way

You should probably use "extractText" on this field first and then truncate.

fieldname.extractText.truncWithExpand(100)

  https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

Also make sure, please that you are not on a ConfiForms version where we had a regression issue with escaping HTML contents (please always upgrade to latest version if possible)

I did try with "extractText" too. Unfortunately, I get the same result.

I started using ConfiForms about 2-3 weeks ago, so I guess the version must be pretty recent.

I also tried with ".renderAsHtml" at the end, but this didn't help either.

The field I am trying to truncate is a "Textarea."

Could you check the version of the app?

I have quickly verified the function and it seems to work for me...

http://recordit.co/DeUWAgo7Hg

The version is 1.2.36-AC

I have also noticed that your app looks slightly different than ours. For example, I don't have the highlighted text in the field description as in the image.

snip_20201016221229.png

OK, it looks like you are using Confluence cloud and therefore ConfiForms for Confluence cloud.

We have identified the issue and whitelisted this function to "not escape" the output generated (was preventing possible XSS vulnerabilities)

It works like a charm now. Thank you!

On a side note, is there a function in ConfiForms which allows the text to collapse again after it has been expanded (without refreshing the window)?

Not at the moment. This function works one way only. We have a feature request to get it extended, so it will be there one day

But I cannot give you any ETA at this point

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

216 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you