Modify hyperlink in rich text field RRS feed

  • Question

  • Hi,

    In an InfoPath form I have a repeating section with a rich text field.
    In this field users often adds hyperlinks to a document library.
    My task is to, on load change the hyperlink so that it will point to another library.
    Sometimes the users also adds a display text to the hyperlink so I must change the hyperlink behind that text.

    In rich text field1 in a repeating section I have a hyperlink http:// SharePointSite/Library1/document.docx.
    When the form is opened the hyperlink in field1 must change to
    http:// SharePointSite/Library2/document.docx.

    Can anyone please help me accomplish that with C#? I am working in InfoPath 2010.

    • Edited by HansRos Monday, December 5, 2016 1:28 PM
    Monday, December 5, 2016 12:38 PM

All replies

  • Hi HansRos,

    According to your description, after users add a hyperlink with library1 in a form, it change to library2 when you open this form item.

    Per my test, when I add a repeating section with rich text box, click Data->Form Load in the ribbon, add rules, and then I open this item, it display the hyperlink only as a text:

    So I suggest you add a repeating section with hyperlink control instead.

    Click the Form Load.

    Add rule as below:

    Then the hyperlink changed with the display name unchanged.

    Best Regards,

    Grace Wang

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, December 6, 2016 1:17 PM
  • Hi Grace,

    Thanks for your reply.

    My problem here is that this form has been used for a long time and I cannot just add a new control for hyperlink.
    All rich text fields will still be there with incorrect links.
    I need a solution that loops through the repeating section looking for hyperlinks in my rich text field containing Library1 and replace it with Library2.
    To make it even more complex, there can be more than one hyperlink in each rich text field.

    Best regards,

    Wednesday, December 7, 2016 11:38 AM