randdevin Posted October 11, 2016 Share Posted October 11, 2016 Customer is wanting to force an email address to use a certain FQDN. they only want the customer to enter everything before the @. Issue is some people can't read and they enter the full email address. So were looking at removing the complexity for the end users and create a rule that is smart enough to remove the @ and everything after. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
step Posted October 11, 2016 Share Posted October 11, 2016 return Field("Email").replace(/@.*/, ''); Quote Link to comment Share on other sites More sharing options...
randdevin Posted October 11, 2016 Author Share Posted October 11, 2016 Thanks step... What you supplied is always assuming that they supply the @. See some users know to only enter everything before the @ while others do not. Thanks Quote Link to comment Share on other sites More sharing options...
step Posted October 11, 2016 Share Posted October 11, 2016 Thanks step... What you supplied is always assuming that they supply the @. See some users know to only enter everything before the @ while others do not. Not sure I follow. If they don't supply the '@domain.com', it doesn't need to be removed. return 'jdoe'.replace(/@.*/, ''); // returns jdoe return 'jdoe@gmail.com'.replace(/@.*/, ''); // returns jdoe Quote Link to comment Share on other sites More sharing options...
randdevin Posted October 11, 2016 Author Share Posted October 11, 2016 That is correct, but I was looking to have the javascript add the @domain.com all in a single step. Quote Link to comment Share on other sites More sharing options...
step Posted October 11, 2016 Share Posted October 11, 2016 Oh okay, you can still do that: return Field("Email").replace(/@.*/, '') + '@domain.com'; Or if you want to do it all from within the replace method: return Field("Email").replace(/(.)(@.*)?$/, '$1@domain.com'); Quote Link to comment Share on other sites More sharing options...
randdevin Posted October 12, 2016 Author Share Posted October 12, 2016 Thats perfect! Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.