Adding popup to Checkbox

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I use popups periodically to my buttons to prevent actions in my pages.

When I tried this with a checkbox:

DeclineSSN.Attributes.Add("onClick", "if(!confirm('Declining to enter SSN
will prevent the hiring process to continue.\n\n Are you sure you
want Decline?'))return;")

it worked as far as not doing an autopostback if cancel is selected. But the
box still gets selected.

Is there a way to prevent a checkbox from being selected if the Cancel
button is chosen?

Thanks,

Tom
 
I figured out how to get the checkbox to not get selected by changing my
statement like so:

DeclineSSN.Attributes.Add("onClick", "return confirm('Declining to enter SSN
will prevent the hiring process to continue.\n\n Are you sure you
want Decline?');")

But the autopostback doesn't work if I select OK, as it should.

Is there something else I need to make this work?

One of the things I want to do is turn the confirm box off if selecting the
checkbox.

Thanks,

Tom
 
What happens if you use return false, instead of just return?

Bob Lehmann
 
Is Autopostback set to true for the checkbox?
I figured out how to get the checkbox to not get selected by changing my
statement like so:

DeclineSSN.Attributes.Add("onClick", "return confirm('Declining to enter SSN
will prevent the hiring process to continue.\n\n Are you sure you
want Decline?');")

But the autopostback doesn't work if I select OK, as it should.

Is there something else I need to make this work?

One of the things I want to do is turn the confirm box off if selecting the
checkbox.

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top