extract text from HTML field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2014 11:46 PM
Hi,
I have a custom HTML field in a table. In business rule I want to extract a plain text from that field.
In client script I used below code and it is working. But in business rule it is not working. Let me know what I need to do in Business Rule.
var html = "<p>Some HTML</p>";
var div = document.createElement("div");
div.innerHTML = html;
var text = div.textContent || div.innerText || "";
Regards,
Giri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2014 01:21 PM
I have not had to parse HTML fields for data, however would you not be able to:
a) convert it to a string
b) search for the location of <p> and </p> tags
c) use substring to pull out what is in between
Perhaps one of the more experienced people can help out without having to convert it, however the above is only a couple lines of code and would do the trick if you cannot find something more "pretty".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2014 11:24 PM
Hi Trevor,
Thanks for your reply. I have the data in <table> tags. I can't use substring or replace functions to pull the data.
Any other solution is helpful.
Regards,
Giri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2014 03:25 AM
Hi Giri,
current.FIELDNAME.getHTMLValue();
Replace FIELDNAME with your field element name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2014 10:26 PM
Hi,
Resolved the issue by using regular expressions.
Thanks all for your reply.
Regards,
Giri