/    Sign up×
Community /Pin to ProfileBookmark

validation of radio button

hi
In my application, i have to validate the radio button, showing alert message if checked second time. there are more than one radio button.
pls advice.

thanks in advance

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyMar 02.2006 — What do you mean by "checked second time"?
Copy linkTweet thisAlerts:
@senthilbsauthorMar 02.2006 — click the radio button second time.

thanks
Copy linkTweet thisAlerts:
@bathurst_guyMar 02.2006 — Do you mean that if a user selects a radio button, then changes his/her mind and selects another, and changes his/her mind again and returns to the original selection, you would like an alert to happen?
Copy linkTweet thisAlerts:
@senthilbsauthorMar 02.2006 — Hi bathurst_guy,

No, clicking the same radio button second time, i have to provide alert message.

pls advice


thanks
Copy linkTweet thisAlerts:
@bathurst_guyMar 02.2006 — <input type="radio" name="radio1" onclick="if(this.value=true)alert('You have already selected this...');">

EDIT:

No sorry, that still alerts first click... hang on
Copy linkTweet thisAlerts:
@senthilbsauthorMar 02.2006 — hey, alert message is popped when i clicked first time itself. my requirement is to provide alert message after click the radio button second time.
Copy linkTweet thisAlerts:
@bathurst_guyMar 02.2006 — Yeah I know.

You can do this:&lt;head&gt;&lt;script type="text/javascript"&gt;
var again = false;
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;input type="radio" name="radio1" onclick="if(this.checked==true &amp;&amp; again)alert('You have already selected this...');again = true;"&gt;
&lt;/body&gt;
Copy linkTweet thisAlerts:
@senthilbsauthorMar 02.2006 — hi bath,

Thanks alot
×

Success!

Help @senthilbs 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.18,
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,
)...