/    Sign up×
Community /Pin to ProfileBookmark

Street Address Validation

I am a little rusty with my Javascript so here is my question. I have an order form that validates that all fields that are required are entered prior to submitting a form. I need to add a checkbox/drop down menu for Address 2 to select either Yes or No and if it is Yes, the person would have to enter the information into another field or if no, the form could just be submitted as is. I am looking to have it so if the selection would be yes, a text box would appear that would have to be filled in. Any help you could give me would be greatly appreciated. ?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@BigMoosieSep 01.2005 — Something like this?

if (document.forms.myForm.myCheckBox.checked && document.forms.myForm.myInput.value=="") {
alert("hey!");
return false;
}
return true;
×

Success!

Help @podie1 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.22,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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