My code generates a phone call activity in each customer lead, then records the SMS conversation between that customer and the company. The description may contain an URL to an image that the customer finds relevant.
I can put the URL as text in the description property, but I would like to transform it to a hyperlink (something like an <a> tag of html.) That way I can click to open it directly instead of copy pasting the URL first.
How can I achieve this?
The description field on a phone call is just a plain old text field, so you can't add any formatting or hyperlinks there.
You could make a separate field, single line of text, with a type of URL. Then the URL you input should act as a typical hyperlink.
The data types are documented at Create and Edit Fields.
I believe you're asking about being able to have a large text area, within CRM, that is editable, but allows you to enter, or at least click on, hyperlinks.
I see two supported solutions, but both would take a lot of customization.
Create an HTML webresource that loads the text from the field, parses it, looking for hyper links, and then add's the correct <a> tagging in order for the links to be clickable.
Search for a client side wiki markup Text Editor widget of some sort (possibly something like http://goessner.net/articles/wiky/ ?), and then format the hyper links with the correct markup.
None of CRM data types support native full blown html rendering. If you try to use JavaScript to update the value and try to render it as html, it would trigger a save to the database as CRM would see the attribute value as modified.
Related
So here's the situation. I'm coding a Report in mssql Server report builder and I want one of my tablix text box to contain a clickable link to presumably a C# razor application.
what I've been trying to do is make a link which contains a query string that sends ID over to the RazorApplication which looks something like this right now.
<a href=https://localhost:54455/RazorApp?guid=Fields!ID.Value>PDF</a>
the server and link up until /RazorApp? works, but I need to send the ID along for validation.
The purpose of the application is to get the ID from the query string, cross reference that with the database and then get the corresponding Varbinary(max) value which I then convert back to the PDF it originally was and open it. but in order for that to work, i need to be able to send the ID along.
I have tried using these HTML5 tags which produce this error
using the 'go to URL' function gives the same error even without the HTML tags.
so the big question here is. what are my possibilities in sending over the ID which is a GUID to my application?
On SSRS, you can specify the URL using an expression. Right click the text box in your tablix you want to become a hyperlink and select Text Box Properties. Select the Action Pane and then the Go the URL Radio Button. Click the fx button. Your expression will then (likely) be something like:
="https://localhost:54455/RazorApp?guid=" & Fields!ID.Value
That should then work.
I recently asked a couple of questions on here related to two subjects
1) Stopping HTML that may be posted by a user in a text field to then render as HTMl on a web page
2) Detect links in a string and where they start and end
I am having problems trying to put the two together.
Over all, I have a text box that a user can type into. They are allowed to type in anything they want.
When posted to the server, I want to seek out all links that are in that text and save them to a database table. Then show on the webpage the text they have typed without any HTML except that I put in myself
So if they type www.google.com, i will turn it to http://www.google.com
I can do that no problem. However if they type something like <p style="margin-left:50px">www.google.com</p> it will find the link, change the link, but the web page will turn the margin bit into actual HTML.
I was recommended to use HTML encoding, however if I do it AFTER I have saved the links into the database, the indices are off (start and length of where the links are in the text).
If I do the HTML encoding BEFORE I save the links, the links may get messed up. If they type in
www.google.com
It will encode the text and the link my regex expression will find is
www.google.com">www.google.com</a>
I either need to improve my regex, or find another way
For reference my regex is
#"((www\.|(http|https|ftp|news|file)+\:\/\/)[_.a-z0-9-]+\.[a-z0-9\/_:#=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])"
If I understood this correctly, you need to display any other html tag the user may type in as-is. Try replacing the < and > characters with < and > respectively.
If you do this before you run the regex replace, it should sort out your issue.
I'm trying to highlight the selected text contents by the user inside the HTML page.I have highlited the text using jquery (dot net). Now I need to save some information to the database that makes me able to highlight the same contents again for future loads of the same page, taking care of all inner elements that the text could have inside.
i.e.,
Have a base HTML files thats same for every user, given the freedom to user to highlight content in provided page, after he highlites, information needs to saved to database against each user, so that when user open the same html file again,(HTML files shown in a panel) he gets the same page with the highlighing he had done earlier.
Please suggest what information should I save to database..
any pointer how would I move ahead..
Thanks in advance your help.
not a dot net expert , but it seems like you are storing content in database, when fetching they need to be highlighted.
the best way is save content as html or write you own highlight tag
and then replace it to blank when highlight not needed , and replace it with
<div style="background-color:red"> to highlight.
Hope you are getting the approch.
And if you are using HTML files , then it is always better to store them in database. String manuplation for every request will be much heavy task to do.
I have a section on my website where I plan to add a lot of text-based content, and rather than display this all at once it would be nice if I could add paging on just these pages. If possible, I would like to put all of my content within one content item and have the paging work automatically, building a URL along the lines of http://example.org/articles/title?page=2 or similar.
I've stumbled across an article that mentions paging with Sitecore items and this seems rather close to what I require, although mine requires pagination on a single content item, rather than multiple items. Can someone help me adapt this article towards my needs (if it's on the right track of where I should be looking)?
Is it possible to do this with a Sitecore content item?
http://briancaos.wordpress.com/2010/09/10/create-a-google-style-paging-component-in-c/
I think you'd either want to create your own WebControl and define a custom Render() method that reads the query string to write out the correct information, or you could even do it all in a Sublayout (a user control ASCX file). I've done this before by adding in a custom tag in the Rich text editor via Sitecore (I think I used <hr class="page-break" />) then in my ASCX I'd look for that HTML tag and split the content into chunks from that. I think my solution also used jQuery for some of it but you could probably do it with C# too.
Edit:
You'd want to split the tasks up and have the "paged" content as well as a list of pages (like the article you referenced) so you can easily generate the page buttons. Both of these could be done in two separate repeaters.
You can split the text from a single field into the different pages using approach described here: Split html string to page. All you need to do after that - read the query string and display appropriate block.
If I understand you correctly you have an Item in Sitecore that has x number of text fields and you only want a subset of those displayed depending on input in the querystring ?
In it's simplest form you want a sublayout that handles that.
Basically I'd imagine you having fields called Text1, Text2, text3 etc.
This .ascx could then retrieve the data for fields the fields you'd want using the control and adding them.
Then you could use the code from the article to generate the paging links.
This should be simple enough, but I'd say it would be a better idea to have an item in sitecore and use it's children as the data you want viewed and paged.
It's nicer because if you start out with 5 "page" fields and suddenly want 10, your item will keep on growing, where children can be added without bloating the parent page. Plus the user could then order the children how he sees fit.
I hope this helps a bit.
Im sure this is a common question...
I want the user to be able to enter and format a description.
Right now I have a multiline textbox that they can enter plain text into. It would be nice if they could do a little html formatting. Is this something I am going to have to handle? Parse out the input and only validate if there are "safe" tags like <ul><li><b> etc?
I am saving this description in an SQL db. In order to display this HTML properly do I need to use a literal on the page and just dump it in the proper area or is there a better control for what I am doing?
Also, is there a free control like the one on SO for user input/minor editing?
Have a look at the AntiXSS library. The current release (3.1) has a method called GetSafeHtmlFragment, which can be used to do the kind of parsing you're talking about.
A Literal is probably the correct control for outputting this HTML, as the Literal just outputs what's put into it and lets the browser render any HTML. Labels will output all the markup including tags.
The AJax Control Toolkit has a text editor.
Also, is there a free control like the
one on SO for user input/minor
editing?
Stackoverflow uses the WMD control and markdown as explained here:
https://blog.stackoverflow.com/2008/09/what-was-stack-overflow-built-with/
You will need to check what tags are entered to avoid Cross side scripting attacks etc. You could use a regex to check that any tags are on a 'whitelist' you have and strip out any others.
You can check out this link for a list of rich text editors.
In addition to the other answers, you will need to set ValidateRequest="false" in the #Page directive of the page that contains the textbox. This turns off the standard ASP.NET validation that prevents HTML from being posted from a textbox. You should then use your own validation routine, such as the one #PhilPursglove mentions.