/    Sign up×
Community /Pin to ProfileBookmark

Simple JavaScript ‘isChecked’ help

I need a SIMPLE solution to check if a checkbox in a form is checked before proceeding.

Here’s my code (it doesn’t work):

<script>
function isReady(form)
{
if (isChecked(form.agree)==false)
{
alert(“You must agree to this disclaimer before applying.”);
return false;
}
}
</script>
<form name=”ask” method=”POST” onSubmit=”return isReady(ask);” action=”some action”>
<INPUT TYPE=”checkbox” NAME=”agree”>I Agree.<br>
<input type=”submit” value=”I Agree”>
</form>

Any thoughts? I’m sure there is a very simple solution. I just can’t come up with it.

Thanks.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Dec 15.2005 — isChecked is a function that you do not have listed hence the error.


You can replace it with:

if(!form.agree.checked){

Eric
Copy linkTweet thisAlerts:
@jjoauthorDec 15.2005 — Thanks! That did it.

I thought isChecked was a valid JavaScript command.
×

Success!

Help @jjo 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.20,
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,
)...