Highlighted
dsheaffe Outstanding Contributor.
Outstanding Contributor.
5189 views

Expand / Collapse memo field

Jump to solution
I am looking for a way that I can have something like a "Show more..." / "Show Less..." option linked to a memo field (eg, Description) on a state form.

The use case would be that when the state form loads you see perhaps the first 5 lines of the Description with a link to "Show More" so the user can view the whole Description field.

While I have been playing around with options, I was hoping that someone might already have something in place with form actions (or similar) to save me re-inventing the wheel.

Thanks in advance.
Tags (1)
1 Solution

Accepted Solutions
bamos Absent Member.
Absent Member.

Re: Expand / Collapse memo field

Jump to solution
David,

What do you think of this idea.

On my state form I added a Text field called ShortVer. I also added a button that says "Show All"

Now I create a form action When form is loaded Then run this javascript

var str=GetFieldValue("Description")

var res = str.substring(0, 25);
SetFieldValue("ShortVer", res);


And added another item to the Then to Hide the Description field

So basically the form loads and grabs the first 25 characters of the Description field and hides the Description field

Now I have another form action that says When my button is clicked Show the description field.

You could get pretty clever and switch buttons and choose to hide it again..whatever.

One thing to think about is if your Description field is RichTextEnabled you will see a bunch of HTML in the value so you can run some jquery like this to make it just text.

var text = $(str).text();


Hope it helps
Brian

View solution in original post

5 Replies
bamos Absent Member.
Absent Member.

Re: Expand / Collapse memo field

Jump to solution
David,

What do you think of this idea.

On my state form I added a Text field called ShortVer. I also added a button that says "Show All"

Now I create a form action When form is loaded Then run this javascript

var str=GetFieldValue("Description")

var res = str.substring(0, 25);
SetFieldValue("ShortVer", res);


And added another item to the Then to Hide the Description field

So basically the form loads and grabs the first 25 characters of the Description field and hides the Description field

Now I have another form action that says When my button is clicked Show the description field.

You could get pretty clever and switch buttons and choose to hide it again..whatever.

One thing to think about is if your Description field is RichTextEnabled you will see a bunch of HTML in the value so you can run some jquery like this to make it just text.

var text = $(str).text();


Hope it helps
Brian

View solution in original post

PM Thompson Outstanding Contributor.
Outstanding Contributor.

Re: Expand / Collapse memo field

Jump to solution
Is there a "resize" handle in the lower-right corner of the field? The pic below shows a "Description" field which is a MEMO type field with the resize handle. That allows users to resize the box.
0 Likes
bamos Absent Member.
Absent Member.

Re: Expand / Collapse memo field

Jump to solution
Paul I think what he is saying is when this description field holds a ton of stuff they don't want all the stuff to initially show on the form taking up space but let the user decide if they want to see more.
0 Likes
bamos Absent Member.
Absent Member.

Re: Expand / Collapse memo field

Jump to solution
I should have said I added a Text Control called ShortVer. This isn't an actual field in the database but it just displays an abbreviated version of the description field on the form.
0 Likes
dsheaffe Outstanding Contributor.
Outstanding Contributor.

Re: Expand / Collapse memo field

Jump to solution
Thanks Brian. Just what I needed. The field(s) do have rich text enabled so thanks for covering that as well.

Cheers.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.