mstanton Posted August 18, 2009 Share Posted August 18, 2009 Hello, I would like, if it's possible, to look at what a user enters for an email address, and if the text to the right of the @ symbol is different than a specific line of text, change it to that specific line of text. For example, if someone enters "help@gmial.com" I want it to change to "help@gmail.com" New to JS Language and Rules, so be kind Thanks! Link to comment Share on other sites More sharing options...
esmith Posted August 18, 2009 Share Posted August 18, 2009 Are you referring to spell-checking ability on a web entry form? While it is certainly possible to perform a find & replace within JS, I don't know how realistic it would be to deal with every possible misspelling that might occur. Link to comment Share on other sites More sharing options...
mstanton Posted August 18, 2009 Author Share Posted August 18, 2009 The situation is that we are developing an online store so one of our clients' employees can log in and order VDP business cards. However, the client does not want people to use an email address other than "@xcompany.com". If the employee types in "john.doe@somethingelse.com" the client wants the software to automatically change the "somethingelse.com" to "xcompany.com" regardless of what the employee typed in. So I need to find a way to remove (or completely ignore) ALL text to the right of the @ symbol, and to change it to "xcompany.com". The immediate solution I have come up with is to say "Email Username (BEFORE the @ symbol)" in the Field description, and then use a rule to add "@xcompany.com" to the end of anything they type in, but if they ignore the instructions then it will look like "john.doe@somethingelse.com@xcompany.com" Link to comment Share on other sites More sharing options...
esmith Posted August 18, 2009 Share Posted August 18, 2009 In that case, you can probably use: return Field("YOUR_FIELD").split("@",1) + "@COMPANY.COM"; which will return all data left of the "@" symbol (or entire contents of field if "@" is omitted). Link to comment Share on other sites More sharing options...
mstanton Posted August 19, 2009 Author Share Posted August 19, 2009 Thanks, Eric! It worked like a charm. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.