RadioButton (or Checkbox) event firing if selected (not changed)

T

tshad

Is there a way to allow a user to press a radio button if it is already
selected?

There is an onCheckedChanged event that fires when the person presses the
button and it is isn't selected already. If it is selected, it doesn't
fire. This isn't the case with a checkbox. The event fires whether the
control is already checked or not.

Thanks,

Tom.
 
K

Ken Dopierala Jr.

Hi Tom,

The reason the checkbox event fires is because it changed. When you click a
radio button that is already set it doesn't change so the onCheckedChanged
even will never fire. You'll need to rethink your design. When a user
clicks a radio button do what you need to do. If you have a radio button
checked as default, then when you dish out the page you will need to setup
your code so that everything you would do when that radio button is selected
is already done. Or, just push out the radio buttons with none of them
selected. Having a user click a radio button to select it, when it is
already selected, to perform some action is not very intuitive and probably
would just confuse the user. Good luck! Ken.
 
J

Joaquin Corchero

What you could do is create the event in JavaScript, with the control being
in the server side. You could do that by closing the object in a span an
firing a function in the onclick of the span or the object that you have
your checkbox in.

Good Luck
 
T

tshad

Ken Dopierala Jr. said:
Hi Tom,

The reason the checkbox event fires is because it changed. When you click
a
radio button that is already set it doesn't change so the onCheckedChanged
even will never fire. You'll need to rethink your design. When a user
clicks a radio button do what you need to do. If you have a radio button
checked as default, then when you dish out the page you will need to setup
your code so that everything you would do when that radio button is
selected
is already done. Or, just push out the radio buttons with none of them
selected. Having a user click a radio button to select it, when it is
already selected, to perform some action is not very intuitive and
probably
would just confuse the user. Good luck! Ken.

I agree.

I was trying to build a setup where the user indicates which row to move but
selecting a radio button. I was also using the button to deselect the row
(which you can't do if it is already selected - as you know). I went to the
checkbox, because it does allow you to select/deselect it. But then you get
the same problem - that it is counter-intuitive to the user who is used to
selecting multiple checkboxes (which would not be the case here).

What I will probably do is go back to the radio button, with a like that
says "deselect"?

Thanks,

Tom
 
T

tshad

Joaquin Corchero said:
What you could do is create the event in JavaScript, with the control
being in the server side. You could do that by closing the object in a
span an firing a function in the onclick of the span or the object that
you have your checkbox in.

Not really quite sure how to do that.

My problem would be how to get the javascript to access the objects in the
row.

When I selected a button it changes the color of the row as well as some of
the labels to indicate the row has been selected. When I select it the
second time, it puts it all back to it's original state.

Not quite sure how I could easily do this from Javascript.

Thanks,

Tom
 
J

Joaquin Corchero

Hi,

Can you tell me if when you look at the code generated in the client browser
you have an ID for each object?

<td id="td1"???
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top