Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-30-2007, 03:21 PM   PM User | #1
anilreddy76
New Coder

 
Join Date: Jun 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
anilreddy76 is an unknown quantity at this point
Making Checkbox selected after returning java script.

Hi,

I'm having the following javascript code,after all the checkboxes are unslected,i'll display the alert to user saying that "Atleast one must be selected",but the checkbox is becoimng unselected,how to make check box selected after throwing this alert.

var checkSelected = false;
for (i = 0; i < planForm.locationOptions.length; i++) {
if (planForm.locationOptions[i].checked) {
checkSelected = true
document.planForm.action='refreshPlanView.do';document.planForm.submit();
document.getElementById("refreshing").style.display="block";
}
}
if (!checkSelected) {
alert("At least ONE Location must be selected!");
return false;
}
return true;
}

Thanks,
Anil
anilreddy76 is offline   Reply With Quote
Old 08-30-2007, 03:30 PM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
Code:
if (!checkSelected) {
alert("At least ONE Location must be selected!");
setSelected(urCheckbox);
return false;
}
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Old 08-30-2007, 04:12 PM   PM User | #3
anilreddy76
New Coder

 
Join Date: Jun 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
anilreddy76 is an unknown quantity at this point
Hi,

Thanks for ur reply.

I've used setSelected(locationOptions[i]);

but it is not setting the checkbox as selected after throwing the alert,it is unchecking the checkbox.

please advise.

Thanks,
Anil
anilreddy76 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:33 AM.


Advertisement
Log in to turn off these ads.