ewitkows
ewitkows

Reputation: 3618

Can I have different name and id attributes on a form element?

I have a web form with usual elements (first name, last name, etc). The Postback URL is a different website altogether as the form is intented to post lead information to another website.

The site that accepts the lead is expecting First Name to come over as "FName", and Last Name to come over as "LName". Is there any way I can set the ID of a textbox to "txtFName", but submit it over the wire as "FName"? I tried changing the name attribute, but at runtime it sets the name = id.

Upvotes: 1

Views: 363

Answers (2)

Gerhard Presser
Gerhard Presser

Reputation: 489

for 'standard-html-input-elements', the name attribute, is the one being submitted, the id-attribute may be used e.g. in javascript.

Upvotes: 0

SLaks
SLaks

Reputation: 887305

You should use normal (non-runat="server") <input> elements.
You will then have complete control over the name and id.

Upvotes: 2

Related Questions