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?
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?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you check the version of the app?
I have quickly verified the function and it seems to work for me...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I noticed the truncWithExpand doesn't work properly with WYISWYG Simple Editor. Any idea why?
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, it does work.. but you have to understand that it truncates the HTML that the WYSIWYG field stores
You need to either extract the text (using extractText function) and then truncate.. or not truncate the HTML contents with the mentioned function
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.