# Mitigate duplicate data capture

**URL:** <https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313>\
**Category:** Development\
**Tags:** forms, extension-libs, descendant-of-curren\
**Created:** [February 6, 2024, 12:35pm UTC](https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313 "2024-02-06T12:35:48Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![jkuester](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/jkuester/32/806_2.png) [@jkuester](https://forum.communityhealthtoolkit.org/u/jkuester)\
**Post date:** [February 15, 2024, 7:53pm UTC](https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313/9 "2024-02-15T19:53:00Z")

</div>

I added a response [in this thread](https://forum.communityhealthtoolkit.org/t/write-custom-transition-and-edit-contact-form-with-task/3334/2) to some of the design proposals included in both threads.

Regarding manually including a redirect link in a form, I think you are on the right path with the anchor. Setting `target="_self"` as an attribute on the anchor (as you probably know) should make it open the link in the same tab. But, of course, this is not useful for markdown links. And, as you have noticed, our [dynamic-url widget](https://github.com/medic/cht-core/blob/master/webapp/src/js/enketo/widgets/dynamic-url.js) only works for markdown links… or does it? 🤔

It took some tinkering, but I found the proper format to use for your html anchor in a form label to actually be able to trigger the dynamic-url functionality for your custom link!

```html
<a target="_self" href="#" rel="noopener" class="dynamic-url">
    ${my_name}
    <div class=”url hidden">${link}</div>
</a>

```

With that as your “label text”, it should dynamically load both the link text (from `my_name`) and the actual link href value (from `link`). (The `dynamic-url`/`url` classes here trigger the dynamic-url widget code to automatically read the `link` value and set it as the `href` on the anchor.)

For bonus points, you can re-use the bootstrap classes we already have loaded and update the anchor to have: `class="dynamic-url btn btn-primary" style=”display:inline-block;"` and you get a very nice looking button! (Though it should be noted that these bootstrap classes are not formally guaranteed to exist in future versions of the CHT. Really all of this is pretty much “use at your own risk”…)

---

_[View the full topic](https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313)._
