# Calling transformUsername() from Hosted Widget

**URL:** <https://devforum.okta.com/t/calling-transformusername-from-hosted-widget/5434>\
**Category:** Questions\
**Created:** [June 18, 2019, 6:07pm UTC](https://devforum.okta.com/t/calling-transformusername-from-hosted-widget/5434 "2019-06-18T18:07:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chu123](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/chu123/32/1816_2.png) [@chu123](https://devforum.okta.com/u/chu123)\
**Post date:** [June 18, 2019, 6:07pm UTC](https://devforum.okta.com/t/calling-transformusername-from-hosted-widget/5434/1 "2019-06-18T18:07:12Z")

</div>

Hello,

I’m trying to setup a function to handle transformUsername() using the Hosted Sign-In widget (i.e.: writing the function within the Okta Customization HTML editor). I’m not having much luck however – if you’ve done this before, can you advise where and how to place a transformUsername function into the hosted HTML sections?

Thanks.

---

<div class="post-metadata">

**Author:** ![chu123](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/chu123/32/1816_2.png) [@chu123](https://devforum.okta.com/u/chu123)\
**Post date:** [June 20, 2019, 12:48pm UTC](https://devforum.okta.com/t/calling-transformusername-from-hosted-widget/5434/2 "2019-06-20T12:48:31Z")

</div>

Of course, this was trivial … just FYI:

```
  config.transformUsername = function(username,operation) {
              partner = document.getElementById("okta-signin-partner").value;
              value = partner + username;     
              return value
          }

```

Where `partner` is a new form field I introduce (see my other post re: calling afterRender to modify the GUI to add a second username input field).

---

<div class="post-metadata">

**Author:** ![ABD](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@ABD](https://devforum.okta.com/u/ABD)\
**Post date:** [May 6, 2021, 2:48pm UTC](https://devforum.okta.com/t/calling-transformusername-from-hosted-widget/5434/3 "2021-05-06T14:48:24Z")

</div>

Hi I am in a similar situation, I believe the above block of code goes before the line  
`var oktaSignIn = new OktaSignIn(config);`  
Yet It does not seem to be processing, Am I missing something here

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [May 7, 2021, 2:48pm UTC](https://devforum.okta.com/t/calling-transformusername-from-hosted-widget/5434/4 "2021-05-07T14:48:48Z")

</div>

Closed on May 7, 2021, 2:48pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
