473,811 Members | 3,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Radio buttons do not appear checked

<b>Agency 4</b>
<input type="radio" name="permissio n[4]" value="1" checked> Yes
<input type="radio" name="permissio n[4]" value="0" > No
<br>
<b>Agency 5</b>
<input type="radio" name="permissio n[5]" value="1" checked> Yes
<input type="radio" name="permissio n[5]" value="0" > No
<br>
I have it set up this way but upon viewing in the browser none of the
radio buttons appear checked.

By the way the radio button names MUST remain in the PHP array format
as they will be referenced EXACTLY like that by PHP on the server end.
Sorry can't change that.

What can I do?

Phil
Jul 20 '05
23 2467
I noticed that Message-ID: <72************ **@merlyn.demon .co.uk> from Dr
John Stockton contained the following:
if (box.checked == false) box.checked = true;


Unless you feel that false might have been redefined, there is no need
to compare with false; there is a NOT operator.

if (!box.checked) box.checked = true;

There may be no need to test that it is not checked before checking it.


Well that's what you get for nicking bits of code. ;-)

Honestly John, that problem drove me up the wall - I was just happy to
get it working. I had my own code (probably equally as bad) but
scrapped it for something I found on the 'net to get it working. I
guess my own would have worked had I figured out the error.

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 20 '05 #21
VK
We went deep to the jungles of the abstract programming.
I'm afraid only ECMA/ISO guys (or a 3rd-4th grade Computer Science student
who's forced to remember this stuff) would be capable to finalize the
discussion.

I personally don't see what you see in the 11.2.1 of ECMA specs.
IMHO it just says that the Object.Property construct can be presented
in two ways (or a combination of both):
by literals: ObjectName.Prop ertyName
by expressions: (ExpressionForO bjectName)[ExpressionForPr opertyName]

The same paragraph states that the final result of evaluation in both cases
is an Identifier (I read: "ECMA-compliant identifier"). No mentions anywhere
that such identifier would have more format freedom
than any other identifier.

I still think that 3W did a big boo-boo. Trying to satisfy the wildest
naming desires in their DOM/XML models, they neglected the fact that all
this data
will be inevitable treated by some programming language
(PHP, ASP-VScript, Perl, Java, JavaScript etc.)
based on the much more conservative ISO standards.

IMHO it didn't blow up yet just because of some healthy conservatism
of the programmers' community. If you did programming long enough,
it takes some guts and a good shoot of whisky to create an object
_$$_\u0410\u041 E_
with a property \041F$$_$
But I'm expecting a lot of fun later when programmers will become more dare
and will try to fully use the given naming freedom.
Still would be interesting to know the Final Right Answer...

ECMA 262 Section 7.6 describes the rules that apply whenever the
production - Identifier - is used. However, Section 11.2.1 (Property
Accessors) includes the productions (for bracket notation):-

MemeberExpressi on [ Expression ]
- and -
CallExpression [ Expression ]

- and the algorithm for resolving these property accessors is:-

<quote cite="ECMA 262 3rd Edition Section 11.2.1 Property Accessors">
...
The production MemberExpressio n : MemberExpressio n [ Expression ] is
evaluated as follows:

1. Evaluate MemberExpressio n.
2. Call GetValue(Result (1)).
3. Evaluate Expression.
4. Call GetValue(Result (3)).
5. Call ToObject(Result (2)).
6. Call ToString(Result (4)).
7. Return a value of type Reference whose base object is
Result(5) and whose property name is Result(6).

The production CallExpression : CallExpression [ Expression ] is
evaluated in exactly the same manner, except that the contained
CallExpression is evaluated in step 1.
</quote>

The result of the - Expression - is used as the property name and the
algorithm does not require that string to conform to the rules for -
Identifier - (it doesn't even check).

So, while production rules that resolve to - Identifier - should produce
errors if the character sequence used does not conform to the rules for
Identifier, ECMA Script does allow properties to be created and read
with _any_ name. If the name does not conform to the rules for
Identifier then it is necessary to use bracket notation to access the
property as that side steps the rules for Identifier.

Therefor a conforming ECMA Script implementation must allow properties
to be created and accessed by _any_ name.

And this is a good thing as even the erroneous interpretation of HTML
CDATA attribute values that attempted to place the NAME and ID
restrictions upon them still allowed character that would not be allowed
in an ECMA Script identifier.

The point at which HTML naming is restricted by the desire to script is
when the attribute values represent integer numbers, but that is more a
consequence of the DOM implementation than ECMA Script as HTML
collections make nodes available as both named properties and as integer
indexed members. So an attempt to read a property of a collection that
is named as an integer number stands a very good chance of returning the
wrong node (or just confusing the DOM implementation) .

On the whole, it must be easier to side step the issue by assigning
values to HTML name and ID attributes that are also valid ECMA script
identifiers (indeed that would be the natural thing to do under most
circumstances) but when that is not possible ECMA script is quite
capable of coping with the results (at least under all realistic
circumstances).

Richard.



Jul 20 '05 #22
"VK" <sc**********@y ahoo.com> wrote in message
news:3f******** *************** @news.freenet.d e...
We went deep to the jungles of the abstract programming.
I'm afraid only ECMA/ISO guys (or a 3rd-4th grade Computer
Science student who's forced to remember this stuff) would
be capable to finalize the discussion. I personally don't see what you see in the 11.2.1 of ECMA specs.
IMHO it just says that the Object.Property construct can be
presented in two ways (or a combination of both):
by literals: ObjectName.Prop ertyName
by expressions: (ExpressionForO bjectName)[ExpressionForPr opertyName] The same paragraph states that the final result of evaluation in
both cases is an Identifier (I read: "ECMA-compliant identifier").
The ECMA Script algorithm states that the final result of the Expression
used in bracket notation is a string representing a property name. I
suspect that you are being confused by the part of Section 11.2.1 that
reads:-

<quote cite="ECMA 262 3rd Edition Section 11.2.1 Property Accessors">
....
The dot notation is explained by the following syntactic conversion:

MemberExpressio n . Identifier

is identical in its behaviour to

MemberExpressio n [ <identifier-string> ]

and similarly

CallExpression . Identifier

is identical in its behaviour to

CallExpression [ <identifier-string> ]

where <identifier-string> is a string literal containing
the same sequence of characters as the Identifier.
....
</quote>

However, this does not mean that the Expression used in bracket notation
must follow the restrictions imposed on Identifier. It states that if
the Expression in a bracket notation property accessor resolves to the
same character sequence used for the Identifier in a dot notation
accessor then the behaviour of the two would be identical.

Because dot notation requires an Identifier to appear to the right of
the dot a property that can be accessed by dot notation must have a name
that satisfies the Identifier rules. That is a syntax rule imposed on
ECMA Script source code, but property access itself is governed by the
algorithm stated in Section 11.2.1 and that algorithm does not impose
any restrictions on the character sequence used.
No mentions anywhere that such identifier would have more
format freedom than any other identifier. <snip>

Section 11.2.1 defines Property Accessors not Identifiers, and places no
restrictions on the character sequence that can be used in a property
name. Dot notation is subject to the rules for Identifier because its
production directly employs the Identifier production, bracket notation
does not draw on the Identifier production so it is only subject to the
rules for Property Accessors; the Expression may result in _any_
character sequence.
Still would be interesting to know the Final Right Answer...


The Property Accessor algorithm is the correct and final answer to the
question of what character sequences may be used as property names in
ECMA Script. It is possible (even probable) that implementations place
some additional restrictions on property names, such as their maximum
length, but ECMA Script does not.

Richard.
Jul 20 '05 #23
"VK" <sc**********@y ahoo.com> writes:
I'm afraid only ECMA/ISO guys (or a 3rd-4th grade Computer Science student
who's forced to remember this stuff) would be capable to finalize the
discussion.
I think I qualify. I'm might not be forced to remember it, but I'm way
past 4th grade computer science :)
I personally don't see what you see in the 11.2.1 of ECMA specs.
IMHO it just says that the Object.Property construct can be presented
in two ways (or a combination of both):
by literals: ObjectName.Prop ertyName
by expressions: (ExpressionForO bjectName)[ExpressionForPr opertyName]
It says the
memberExpressio n.Identifier
is evaluated just as
MemberExpressio n[<identifierStri ng>]
where <identifierStri ng> is a string literal containing the string
corresponding to the identifier. This only goes one way. That part makes
no statements about how MemberExpressio n[Expression] is in fact evaluated.
That comes right after.
The same paragraph states that the final result of evaluation in both cases
is an Identifier (I read: "ECMA-compliant identifier").
In ECMA 262, version 3 final (24. March 2000), section 11.2.1? I can't
see that. In fact, there seems to be no occurances of either
"ECMA-compliant" or "compliant identifier".

What I can see is the evaluation of MemberExpressio n[Expression]:
---
1. Evaluate MemberExpressio n.
2. Call GetValue(Result (1)).
3. Evaluate Expression.
4. Call GetValue(Result (3)).
5. Call ToObject(Result (2)).
6. Call ToString(Result (4)).
7. Return a value of type Reference whose base object is Result(5) and
whose property name is Result(6).
---

There is nothing in this definition that prevents Result(6) from being
any string. In fact, since Expression can be a string literal, any
string that has a literal represnetation (they all do) can be used
as a property name.

Looking through ECMA 262 (the one from 1999, not the final version, I
can't stand to read the sans-serif font!) I can't see any definition
of what a legal property name is. What I can see is, as above, that
any string will work, and that anything used as a property will be
converted to a string, so property names are probably strings.
It's not specified explicitly, though. I would call that an oversight,
considering how much detail they go into in other cases.
I still think that 3W did a big boo-boo. Trying to satisfy the wildest
naming desires in their DOM/XML models, they neglected the fact that all
this data will be inevitable treated by some programming language
(PHP, ASP-VScript, Perl, Java, JavaScript etc.)
based on the much more conservative ISO standards.


Not a problem. All collections will have a "namedItem" method that can
be used with a language level string as an argument.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #24

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

Similar topics

15
10807
by: Phil Powell | last post by:
<b>Agency 4</b> <input type="radio" name="permission" value="1" checked> Yes <input type="radio" name="permission" value="0" > No <br> <b>Agency 5</b> <input type="radio" name="permission" value="1" checked> Yes <input type="radio" name="permission" value="0" > No <br>
2
3158
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as they want. If they need to add more, they click an "add name" button and the javascript inserts another row of input boxes. Each row should have two radio buttons to indicate sex (M F). When you have multiple text input boxes with the same...
4
3284
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> <input type="radio" name=p2 value=2> <input type="radio" name=p2 value=3> then a text area and a button:
6
3296
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked The problem i am facing is that i do not know how many yes/no radio groups will be generated
6
11190
by: juli | last post by:
Hello, I need a control which will contain radio buttons that will be added in a loop. I am using this control a source of some other control. I tried to use group box windows control and to add the radio buttons this way(in a loop): this.groupBox1.Controls.Add(radio); but I can see there only one radio button . How can I see all of them or maybe I should use some kind of radio buttons array first?
2
3497
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button "No", he should not have the option of clicking on any of the six checkboxes. See Code attached. Thank you so much in advance for your help as I can't get to make this combo work. <p>Did you have any problems finding any of the information...
1
8862
by: Jerry | last post by:
We have a 10-question quiz for kids, each question being a yes or no answer using radio selections. I'd like to keep a current total of yes's and no's at the bottom of the quiz (if the user selects yes to question 1, the total of yes's increases by 1). I've been searching for a while but I'm not sure I'm searching with the right keywords. Can anyone direct me to a source I can review to learn how to do this? Thanks! --
7
2534
by: nathaniel.k.lee | last post by:
Is it not possible, in IE, to dynamically click a radio button? I'm grabbing some values from a database and using them to populate radio buttons on a page. I have alternate code for Firefox browsers using the setAttribute() function. Everything works as planned in Firefox but in IE, the buttons won't populate and, what's worse, I can't even click on them after everything loads. I see the slight shadow that indicates you're clicking on a...
2
5897
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on the form by changing the visible state of the radio buttons and labels utilising back and next buttons. E.g. Next button makes current radio buttons and labels invisible and
4
3093
by: Z.K. | last post by:
I started a forms application and I put on the form three buttons. In the functions for the radio buttons I put in a single messagebox like: MessageBox("Hello 1") MessageBox("Hello 2") MessageBox("Hello 3")
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.