469,575 Members | 1,668 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

name property for <form does not appear html page

I have a vb.net page that uses a form as below:

<form id="Visual" name="Visual" method="post" runat="server">

If I run this on my Windows XP development PC then the HTML generated from
it is:

<form name="Visual" method="post" action="Salesreport.aspx?Index=7"
language="javascript" onsubmit="javascript:return WebForm_OnSubmit();"
id="Visual">

As you can see the form still contains the 'name=...'

However if I run the same form on my live Windows 2000 server, the HTML
generated is:

<form method="post" action="Salesreport.aspx?Index=7"
onsubmit="javascript:return WebForm_OnSubmit();" id="Visual">

and as you can see the 'name' and 'language' properties are missing.

I need the 'name' property to appear as in my development environment as
this is used by a calendar control that is called from the page.

Has anybody any idea why it appears on my dev PC and not my live server?

Is it a versioning issue, and if so how do I go about checking versions etc?
Thanks, Mike.

Jun 8 '06 #1
7 1410
Hi Mike,

Thank you for your post.

I was unable to repro the problem you described. Simply create an empty
WebForm with the form declaration you provided will produce same result on
Windows XP and 2000. Since the html source your described contains some
other attributes, I think you must have been using custom code to modify
the form. Would you mind posting some more code or creating a repro project
for that? Also, please tell me which ASP.NET version you are using. Thanks.
Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 9 '06 #2
Walter,

First of all apologies as the live server the code is running on is Windows
2003 Web Server, and not Windows 2000 Server as I put in my first post! (I
have 2 live servers!)

I tried a blank form as you suggested, and it had the same result.

Interestingly when the start of the form is as follows:

<form name="TestForm" id="form1" runat="server">

The development PC (Windows XP) comes back with:

<form name="form1" method="post" action="Test.aspx" id="form1">

i.e. the name has been changed to 'form1' from 'TestForm'. This would not
be a problem for me, but it not appearing at all does!

The live Windows 2003 server still comes back without a name, i.e.:

<form method="post" action="Test.aspx" id="form1">

I think it must be due to slight differences in the versions of .Net running
- How do I as you suggest check the versions that are running?, and what do I
do if the Windows 2003 server is out of date?
Thanks, Mike.
"Walter Wang [MSFT]" wrote:
Hi Mike,

Thank you for your post.

I was unable to repro the problem you described. Simply create an empty
WebForm with the form declaration you provided will produce same result on
Windows XP and 2000. Since the html source your described contains some
other attributes, I think you must have been using custom code to modify
the form. Would you mind posting some more code or creating a repro project
for that? Also, please tell me which ASP.NET version you are using. Thanks.
Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 9 '06 #3
Hi Mike,

Thank you for your update.
The name attribute is only valid on the <form> and form elements (such as
<input>, <textarea>, <select>). It's used to specify the name to associate
with the name/value pair that is submitted on a form post.

For example:

<input type=checkbox name=foo value=1>

If checked will submit with foo=1.

In the DOM you can reference form elements from the form.elements
collection by specifying the name as the index. If the name is not unique,
the collection returns an array of elements rather than the element. You
can look up form elements by name:

document.getElementsByName(nameValue)

Note: if always returns an array even if only one element is found.

The id attribute is from the XML world, and is unique for any node, not
just for form element. To find any html element by id:

document.getElementById(idValue)

This only returns one dom node.

Based on my research, the name attribute is always generated by ASP.NET and
forced set to its id attribute value, regarding whether or not you
specified it manually. Also it works the same way either in ASP.NET 1.1 and
2.0.

To check the ASP.NET version used in a website, in IIS manager, you can
open the Properties dialog of the website and find a tab named "ASP.NET",
there's a Combobox to change the ASP.NET version, --if you've installed
multiple .NET framework versions.

Hope this helps.

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 9 '06 #4
It's very strange that it should be produced, yet isn't on the live 2003 web
server.

The versions of ASP.NET are:

- 2.0.50215.0 on the Windows 2003 Web Server, and
- 2.0.50727 on the dev PC.

Is it worth me trying to update the version on the Windows 2003 Web Server,
and if so where is the best place to get it from?
Thanks, Mike.

"Walter Wang [MSFT]" wrote:
Hi Mike,

Thank you for your update.
The name attribute is only valid on the <form> and form elements (such as
<input>, <textarea>, <select>). It's used to specify the name to associate
with the name/value pair that is submitted on a form post.

For example:

<input type=checkbox name=foo value=1>

If checked will submit with foo=1.

In the DOM you can reference form elements from the form.elements
collection by specifying the name as the index. If the name is not unique,
the collection returns an array of elements rather than the element. You
can look up form elements by name:

document.getElementsByName(nameValue)

Note: if always returns an array even if only one element is found.

The id attribute is from the XML world, and is unique for any node, not
just for form element. To find any html element by id:

document.getElementById(idValue)

This only returns one dom node.

Based on my research, the name attribute is always generated by ASP.NET and
forced set to its id attribute value, regarding whether or not you
specified it manually. Also it works the same way either in ASP.NET 1.1 and
2.0.

To check the ASP.NET version used in a website, in IIS manager, you can
open the Properties dialog of the website and find a tab named "ASP.NET",
there's a Combobox to change the ASP.NET version, --if you've installed
multiple .NET framework versions.

Hope this helps.

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 9 '06 #5
Hi Mike,

Thank you for your update.

Looks like you're not running latest version of ASP.NET on the Windows 2003
Server, try to update it.

Please feel free to post here if you need more help.

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 12 '06 #6
Walter,

I thought the version of ASP.Net that I had on my live server was V 2.0 -
But it looks like it is older than the first RTM, i.e. 2.0 Original RTM
2.0.50727.42 .

Does this mean that the version I have on my live web server is a Beta, and
I will therefore have to remove it before installing 2.0 Original RTM
2.0.50727.42 ?
Cheers, Mike.

"Walter Wang [MSFT]" wrote:
Hi Mike,

Thank you for your update.

Looks like you're not running latest version of ASP.NET on the Windows 2003
Server, try to update it.

Please feel free to post here if you need more help.

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 12 '06 #7
Hi Mike,

Thank you for your update.

Yes you need to remove the old version and install the RTM version.

Please feel free to post here if you need more help.

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 13 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by hamidi | last post: by
reply views Thread by Victor Yen | last post: by
2 posts views Thread by James Tillery | last post: by
1 post views Thread by --== Alain ==-- | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.