Customer Portal

Get Involved. Join the Conversation.

Topic

    DavidTse
    How to submit username using email address value?
    Topic posted September 12, 2008 by DavidTse Green Ribbon: 100+ Points, last edited October 29, 2011 
    1491 Views, 3 Comments
    Title:
    How to submit username using email address value?
    Content:

    On the create account page we want to submit the username/login using the email address provided. 

     

    Currently on the create_account page I'm still using an Input widget for login.  I'm use a custom FormButton widget where I edit the logic.js to hide the username label and text and then in the clickHandler assign the username to the email value. 

     

    Is there a better way to do this?  Ideally I rather not even use the Input widget for login on the create account page. 

     

    Or better yet, is there a way in the backend to automatically assign username to the same value as email?

     

    Thanks,

    David 

    Comment

     

    • Ernie Turner

      With our current setup, there is no clean way to do this (the ideal way to do this would be to,  as you suggested, automatically copy the username value to the email field). We are going to add the ability to do this in the near future by allowing you to modify the contact record before it gets submitted.

       

      For the time being your solution might have to suffice. Another option here would be to create your own customized Input widget that you only use with the the email field. You would hide the input field in the same way you are now. Then in the onValidate() function, get the value of the 'login' field and set it as the value of the hidden 'email' field. This would accomplish the same goal. If you went this route, it might also be a good idea to remove a bunch of the field specific javascript functions in your custom Input widget logic.js file in order to increase performance.

       

      Also, it might be better to hide the login field instead of the email field. This way, the email address field will get validated in the same way it always does. If you show them the login box, there wouldn't be a requirement for them to enter a valid email address.

       

       

    • Kurt Helfrich
      I realize this is an old thread, but wouldn't this be better accomplished in the contact model - After the email validation, just copy the value into the login field?  It seems a lot simpler to me to do it that way.
    • Ernie Turner
      Yes, since this post was created, we've added numerous features around this scenario. The easiest way to accomplish this is to use the pre_contact_create hook to copy the email into the username. There are already a number of posts about how to do this however.