Naughty radio_buttons

hi:

I have 2 radio buttons that are just interface elements:
radio_button_tag. I don’t really care about their method or object, I
just want to fire some login on the page based on whether or not they’re
clicked. Problem is, they’re not behaving together, meaning I can have
them both be checked at the same time, which is a no-no. Is this a
limitation of radio_button_tag becuase it’s not hooked up to a form.
Here’s my radio button code in my view:

<%= radio_button_tag (’’, 0, checked = false, options = {:onclick =>
“”}) %>
<%= radio_button_tag (’’, 1, checked = false, options = {:onclick =>
“”}) %>

What am I doing wrong? I just want them to perform as normal radio
buttons and then use their “onclick” option to fire off some javascript.

Thanks very much in advance for your help!

Mike

Mike D. wrote:

hi:

I have 2 radio buttons that are just interface elements:
radio_button_tag. I don’t really care about their method or object, I
just want to fire some login on the page based on whether or not they’re
clicked. Problem is, they’re not behaving together, meaning I can have
them both be checked at the same time, which is a no-no. Is this a
limitation of radio_button_tag becuase it’s not hooked up to a form.
Here’s my radio button code in my view:

<%= radio_button_tag (’’, 0, checked = false, options = {:onclick =>
“”}) %>
<%= radio_button_tag (’’, 1, checked = false, options = {:onclick =>
“”}) %>

What am I doing wrong? I just want them to perform as normal radio
buttons and then use their “onclick” option to fire off some javascript.

Thanks very much in advance for your help!

Mike

The name of both radio buttons is ‘’, an empty string. The browser will
only allow one selection based on the radio buttons name. I think the
browser is getting confused by the lack of a name.

So give that first parameter a real value, and it should work fine.

Alex W. wrote:

Mike D. wrote:

hi:

I have 2 radio buttons that are just interface elements:
radio_button_tag. I don’t really care about their method or object, I
just want to fire some login on the page based on whether or not they’re
clicked. Problem is, they’re not behaving together, meaning I can have
them both be checked at the same time, which is a no-no. Is this a
limitation of radio_button_tag becuase it’s not hooked up to a form.
Here’s my radio button code in my view:

What am I doing wrong? I just want them to perform as normal radio
buttons and then use their “onclick” option to fire off some javascript.

Thanks very much in advance for your help!

Mike

The name of both radio buttons is ‘’, an empty string. The browser will
only allow one selection based on the radio buttons name. I think the
browser is getting confused by the lack of a name.

So give that first parameter a real value, and it should work fine.

Hi Alex:

Thanks so much for your reply. I had it this way:

<%= radio_button_tag (‘duedate’, 0, checked = false, options = {:onclick =>
“”}) %>
<%= radio_button_tag (‘noduedate’, 1, checked = false, options = {:onclick =>
“”}) %>

And it still didn’t work. but that’s because there aren’t any values
for these two things, no methods, because they’re really not supposed to
be hooked up to anything.

Any further ideas?

Thanks again!

Mike

Mike D. wrote:

Alex W. wrote:

Mike D. wrote:

hi:

I have 2 radio buttons that are just interface elements:

<%= radio_button_tag (‘duedate’, 0, checked = false, options = {:onclick =>
“”}) %>
<%= radio_button_tag (‘noduedate’, 1, checked = false, options = {:onclick =>
“”}) %>

And it still didn’t work. but that’s because there aren’t any values
for these two things, no methods, because they’re really not supposed to
be hooked up to anything.

Pretty sure that needs to be

<%= radio_button_tag (‘duedate’, 0, checked = false, options = {:onclick
=> “”}) %>

<%= radio_button_tag (‘duedate’, 1, checked = false, options = {:onclick
=>""}) %>

Benjamin Ritcey wrote:

Mike D. wrote:

Alex W. wrote:

Mike D. wrote:

hi:

I have 2 radio buttons that are just interface elements:

<%= radio_button_tag (‘duedate’, 0, checked = false, options = {:onclick =>
“”}) %>
<%= radio_button_tag (‘noduedate’, 1, checked = false, options = {:onclick =>
“”}) %>

And it still didn’t work. but that’s because there aren’t any values
for these two things, no methods, because they’re really not supposed to
be hooked up to anything.

Pretty sure that needs to be

<%= radio_button_tag (‘duedate’, 0, checked = false, options = {:onclick
=> “”}) %>

Hi:

yes, I’ve tried that and that still doesn’t work. Do these need to be in
a form_for or something like that?

Thanks again for any help you can provide!

Mike

<%= radio_button_tag (‘duedate’, 1, checked = false, options = {:onclick
=>""}) %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs