473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

radio button

HI, I have aproblem with XHTML radio button.

<form name=" form">
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
</form>

I want that when the radio is clicked, it is not checked. in other word
I want the click has no effect on the radio.
in IE it work, but in FireFox, the first click check the radio, while
the second, the tirdth, etc.. don't check the radio.
Why the first click is different than the others?

Feb 8 '06 #1
8 4667
stefano wrote:
HI, I have aproblem with XHTML radio button.

<form name=" form">
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
</form>

I want that when the radio is clicked, it is not checked. in other word
I want the click has no effect on the radio.
in IE it work, but in FireFox, the first click check the radio, while
the second, the tirdth, etc.. don't check the radio.
Why the first click is different than the others?


Hi

I think a radio object expects one option to be checked.
If you create some options, many browsers will even check the first if you
do not set another one explicitly (CHECKED).

So I think you are relying on strange/buggy behaviour in whatever it is you
are trying to achieve. :-)

Regards,
Erwin Moller
Feb 8 '06 #2

"stefano" <st**********@tiscali.it> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
HI, I have aproblem with XHTML radio button.

<form name=" form">
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
</form>

I want that when the radio is clicked, it is not checked. in other word
I want the click has no effect on the radio.
in IE it work, but in FireFox, the first click check the radio, while
the second, the tirdth, etc.. don't check the radio.
Why the first click is different than the others?


<script type="text/javascript">
function click4(myName)
{
document.getElementById(myName).checked=true;
}
</script>

<form name=" form">
<input name="radio1" type="radio" onclick="click4()" />
<input name="radio2" type="radio" onclick="click4()" />
<input name="radio3"type="radio" onclick="click4()" />
<input name="radio4" type="radio" onclick="click4()" />
</form>
Totus possum, totum Deum.
Totus ero, totum meum.
WSW
Feb 8 '06 #3
Sorry I just copied your form forgot the changes I made to it

function click4(myName)
{
document.getElementById(myName).checked=true;
}
</script>

<form name="form">
<input name="radio" id="r1" type="radio" onclick="click4('r4')"/>
<input name="radio" id="r2" type="radio" onclick="click4('r4')"/>
<input name="radio" id="r3" type="radio" onclick="click4('r4')"/>
<input name="radio" id="r4" type="radio" onclick="click4('r4')"/>
</form>
Feb 8 '06 #4

"Lee" <RE**************@cox.net> wrote in message
news:ds********@drn.newsguy.com...
News said:

Sorry I just copied your form forgot the changes I made to it


Please don't change the subjects of message threads.


OK won't again
Feb 8 '06 #5
stefano wrote:
HI, I have aproblem with XHTML radio button.

<form name=" form">
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
<input name="radio" type="radio" onclick="return false" />
</form>

I want that when the radio is clicked, it is not checked. in other word
I want the click has no effect on the radio.
Then disable it - no script required:

<input name="radio" type="radio" disabled="disabled" />

Though a better way is to use script to disable it since you will likely
want to use script later to enable it.

It's probably not a good idea to give the buttons a name that is the
same as the value of an HTML attribute, perhaps make the name
'radioGroup01' or similar.

For what it's worth, the following does what you ask (provided script is
enabled):

<input name="radio" type="radio" onclick="this.checked=false;" />
But it does not guarantee that a user can't check the button.

in IE it work, but in FireFox, the first click check the radio, while
the second, the tirdth, etc.. don't check the radio.
Why the first click is different than the others?


What it does for me is keep whichever button I click on first checked,
essentially disabling subsequent clicks. What should 'return false' do
when a radio button is clicked?
--
Rob
Feb 9 '06 #6
Lee wrote:
News said:

Sorry I just copied your form forgot the changes I made to it


Please don't change the subjects of message threads.

On the contrary, always update the subject when it is appropriate so to do.

Usenet messages are threaded by reference header, not by subject, so you
won't break the threads changing the subject except for people using broken
newsreader programs.

(admittedly that particular change of subject wasn't exactly useful, but it
does no harm.)
Feb 9 '06 #7
JRS: In article <ds********@drn.newsguy.com>, dated Wed, 8 Feb 2006
13:48:26 remote, seen in news:comp.lang.javascript, Lee
<RE**************@cox.net> posted :
News said:

Sorry I just copied your form forgot the changes I made to it


Please don't change the subjects of message threads.


Disregard that. It's meaningless (a thread does not have a subject;
articles have subjects) and its intent is wrong.

The subject line can and should be changed if the topic of the article
changes enough to justify it.

There's no need to pander to inferior newsreaders that cannot thread
articles on References.

However, the subject line should not be changed arbitrarily or in the
manner in which "News" changed it.

"News" has provided a demonstration of one of the stupidities of Lahn-
style attributions; they become useless where the "author's name" is not
a name, or is unreasonably short or common.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Feb 9 '06 #8
Lee wrote:
Usenet messages are threaded by reference header, not by subject, so
you won't break the threads changing the subject except for people
using broken newsreader programs.


Of course it doesn't break the threading, but in some (many? most?)
readers, when viewing thread summaries, the thread is titled according
to its most recent subject.

Yes, and that is why as a thread drifts you change the subject to one which
is more relevant. It is also why you should usually preserve the original
subject within the new one as I've done above, at least for the first
message or two after the subject changes. If you were to respond to this
message you could reasonably drop the 'was ...' part of the subject and the
flow of the thread would still be clear to everyone.

You seem to be missing the point entirely though: the change of subject
which sparked this was inappropriate and pointing this out to the OP would
have been fine, but a blanket 'don't change subjects' is plain wrong.
Feb 10 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
3
by: John Davis | last post by:
I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons. When the user click the first radio button, the text will change to uppercase. If the user clicks the other radio button,...
3
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
8
by: David Cameron | last post by:
I noticed that using an HTMLInputRadioButton and specifying a value to be an empty string (""), this is overridden by ASP.Net which set the value of the control to be the same as the ID of the...
1
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
9
by: IchBin | last post by:
I can not see what the problem is with this script. I am just trying to set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry I am new to javascript. <html> <head> <script...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
0
by: jehugaleahsa | last post by:
Hello: I have radio buttons bound to boolean properties in a business object. private void bindRadioButton(RadioButton button, string propertyName) { Binding binding =...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.