Rich Text Box Question

J

JL

Hi,
I'm a desparate InfoPath developer. I have a form that has a button and a
rich textbox. My plan is once a user clicks the button, it will search
strings (in the textbox) that contain certain pattern and convert them into
hyperlinks. I tried to use "translate" function to convert the strings into
HTML (like <a href='someURL'>display text</a>). But it failed. Is it
possible to accomplish this without messing with managed code (in other
words, messing with C# or making the form fully trusted)? Thanks in advance.
 
B

Ben Walters

JL,
If you put managed code behind your form that does not automatically mean
that the form must be fully trusted. The only reason you would need to
digitally sign a form is if the code behind it is accessing files or
resources on the users machine. That being said the Rich text box is a surly
beast at the best of times. All content for a rich text box is stored in
XHTML, however when you get the value from the XML schema in code all the
XHTML tags are removed.
What you will need to do create a new instance of the Node object
representing your rich text box then make changes to that nodes Inner XML to
create your links. Once you have finished working with the node you can then
use the replace node function to put it back into your xml document.
If you have any problems doing this let me know and I'll post up some sample
code

Cheers
Ben
 
J

JL

You are awesome, Ben. True MVP. I had been digging for information in
Google for days. Now I know this is the place I will go if I need InfoPath
helps. Thanks a lot.
 
Top