/    Sign up×
Community /Pin to ProfileBookmark

Javascript form validation

I neeed help with a script validation:
All the form requires is;
full name and;
full address or email address;
the option is that not the address & email address are both required, only one of them, can someone help me?
Ken

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@cgishackJan 14.2008 — You can check if things are valid using simple 'if' statments.

You can get the value of your HTML elements by giving them an unique ID.

Here is a sample of me getting the value of a textbox

<i>
</i>var myTextbox = document.getElementById("textboxID").value;


if someone had the value '123-456-7890' in the textbox with the id 'textboxID' that would give me the value.

Now you can use if statments to see if the value(s) meet you rneeds

Here is a sample
[code=php]
if (myTextbox == '123-456-7890')
{
alert('I like your phone Number')
}
{
else { alert('thats a hard number to remember') }


[/code]


Maybe you can create your custom function with the info i gave you, or at least give you some info to further research.

Drew
×

Success!

Help @tyserman474 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 5.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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