/    Sign up×
Community /Pin to ProfileBookmark

Changing value of text boxes

I I was wondering if someone could help,

I have a form that submits details for a webmail system, the webmail system requires that the e-mail address and the password be entered, what I am wanting to do is make it so that all the users of the webmail system do is enter the first be, for example if there email address was [email][email protected][/email] then all I want them to have to do is enter user and then once they go to the password field I want it to add the @test.com in, I have made a javascript that does this which is as follows:

function setValue(target)
{

target.value += “@lindleys.biz”;

}

However I Now need to add a feature that sees if the user has already entered the domain as well so if the user were to type in [email][email protected][/email] what happens is at the moment it then changes into [email][email protected]@test.com[/email], I need to alter the script so that it validates the field and doesn’t add the domain if it is already there can someone help me aout with this please.

Thanx Rob

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@BrainEaterMar 11.2006 — if(target.value.indexOf('@')!=-1)
target.value += "@lindleys.biz";
Copy linkTweet thisAlerts:
@lindleysauthorMar 11.2006 — That does it backwards, when you place @lindleys.biz in it adds it again and when you don't it does it and I don't know how to change it
Copy linkTweet thisAlerts:
@phpnoviceMar 11.2006 — <i>
</i>if(target.value.indexOf('@') == -1)
target.value += "@lindleys.biz";
Copy linkTweet thisAlerts:
@lindleysauthorMar 11.2006 — cool, that works perfectly thanks
×

Success!

Help @lindleys spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...