473,421 Members | 1,655 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,421 software developers and data experts.

input id attribute

Hello,

The book "Programming ASP.NET" by O'Reilly, an excellent source of ASP.NET
information indeed, specifies that along with the runat="server" attribute
an id attribute should also be specified in order to make use of variable
names. However, the XHTML specification found at the following site:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
does not state anything regarding an id attribute. Despite this fact,
Web Matrix is outputting an id attribute to web clients. Furthermore,
the ASP.NET book mentions nothing about the name attribute (which is
required according to the spec, given below). The name and id attributes
are both output to the client, but isn't the id attribute redundant,
given that the name attribute is already there?

Thank you for your feedback,

Neil

The XHTML spec states the following as part of its DTD:

<!-- the name attribute is required for all but submit & reset -->

<!ELEMENT input EMPTY> <!-- form control -->
<!ATTLIST input
%attrs;
%focus;
type %InputType; "text"
name CDATA #IMPLIED
value CDATA #IMPLIED
checked (checked) #IMPLIED
disabled (disabled) #IMPLIED
readonly (readonly) #IMPLIED
size CDATA #IMPLIED
maxlength %Number; #IMPLIED
src %URI; #IMPLIED
alt CDATA #IMPLIED
usemap %URI; #IMPLIED
onselect %Script; #IMPLIED
onchange %Script; #IMPLIED
accept %ContentTypes; #IMPLIED
align %ImgAlign; #IMPLIED

Nov 19 '05 #1
2 3382
Hi,

You must give the id attribute, if you want to access it from the code in
ASP.NET. ID and Name attribute can be same for a given control. You can
access the control in client side javascript using its name.

Prakash.C

"Neil Zanella" wrote:
Hello,

The book "Programming ASP.NET" by O'Reilly, an excellent source of ASP.NET
information indeed, specifies that along with the runat="server" attribute
an id attribute should also be specified in order to make use of variable
names. However, the XHTML specification found at the following site:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
does not state anything regarding an id attribute. Despite this fact,
Web Matrix is outputting an id attribute to web clients. Furthermore,
the ASP.NET book mentions nothing about the name attribute (which is
required according to the spec, given below). The name and id attributes
are both output to the client, but isn't the id attribute redundant,
given that the name attribute is already there?

Thank you for your feedback,

Neil

The XHTML spec states the following as part of its DTD:

<!-- the name attribute is required for all but submit & reset -->

<!ELEMENT input EMPTY> <!-- form control -->
<!ATTLIST input
%attrs;
%focus;
type %InputType; "text"
name CDATA #IMPLIED
value CDATA #IMPLIED
checked (checked) #IMPLIED
disabled (disabled) #IMPLIED
readonly (readonly) #IMPLIED
size CDATA #IMPLIED
maxlength %Number; #IMPLIED
src %URI; #IMPLIED
alt CDATA #IMPLIED
usemap %URI; #IMPLIED
onselect %Script; #IMPLIED
onchange %Script; #IMPLIED
accept %ContentTypes; #IMPLIED
align %ImgAlign; #IMPLIED
>

Nov 19 '05 #2

Hello,

Thank you for your reply. I see a problem though with id because it
is also used for rendering with CSS. With id used for CSS several
distinct table elements or other elements may use the same id in
order to render in the same way despite the fact that they are
different objects and as such would require different id values
in ASP.NET.

Thank you for your feedback,

Neil

Nov 19 '05 #3

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

Similar topics

8
by: Neil Zanella | last post by:
Hello, I would like to know why the W3C decided not to make the following valid XHTML: <input checked type="radio" name="foo" value="bar" />FooBar forcing people to write the following to...
4
by: Martin Lucas-Smith | last post by:
I am wanting to know whether are XHTML1-valid characters for use within an id attribute and/or a name attribute. ...
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
5
by: Gregg | last post by:
Hello all, I have been banging my head over a problem that I am having reading a comma seperated file (CSV) that can contain from 1 to 10,000 records. My code snipit is as follows: **Start...
2
by: Jim Witte | last post by:
Hi, How do I set a file input element? If it's a text input, I can set the value property. But this doesn't work with file inputs. And no, I can't change it - I'm writing a script to...
4
by: multimatum2 | last post by:
Hello, I need to enable/disable input text forms... But... I need to have the same style (color...) in both modes.. Could you help me ? Thanx a lot A small sample... ...
2
by: charles-brewster | last post by:
I'm trying to write a simple JavaScript function which will use a button to copy table cell data into a form input text box as the "value" attribute. The following is intended to test the...
1
by: S. David Kyle | last post by:
I am having a weird issue when I generate an input Html tag from a Xsl transformation. When the trasform is executed on the xsl below, the <inputtag has the closing slash removed in the first...
5
by: Jeff | last post by:
I needed to to do a quick width set for form input type="text", So: input{ width: 200px; } That also styled all my radio buttons!
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.