[A third attempt - my first two attempts doesn't appear to have shown
up -yet]
I have a bit of code that inserts some extra controls (specifically,
ordinary <input type="hidden" name="MyField"f orm fields) into an existing
HTML form. However, it is mangling the name & IDs of these controls when
they are rendered:
For example, the PPItemName field is rendered as: <input
name="ctl00$Mai nBodyContent$PP ItemName" type="hidden"
id="ctl00_MainB odyContent_PPIt emName" />
Ordinarily, I wouldn't care (and it wouldn't matter either), but this form
is posting to a Paypal server and paypal is expecting particular field
names - so consequently we are having problems.
I can understand that .NET needs to use the ID attribute, but why the name
attribute? The name attribute is important in standard HTML, but I wouldn't
have thought so for .NET.
A workaround would be to use a placeholder, and use .innerHTML to inject
straight HTML inside. But this entire piece of code is already a workaround
for .NETs inability to handle multiple forms, so I thought there must be a
limit to the amount of messing about that I have to do.
Is there a way that I can force the server not to change the name of the
fields?
Thanks in advance...
Chris 11 1895
"CJM" <cj*****@remove me-yahoo.co.ukwrot e in message
news:6j******** ****@mid.indivi dual.net...
I have a bit of code that inserts some extra controls (specifically,
ordinary <input type="hidden" name="MyField"f orm fields) into an
existing
HTML form. However, it is mangling the name & IDs of these controls when
they are rendered:
Correct. That is standard behaviour.
Is there a way that I can force the server not to change the name of the
fields?
Absolutely not! Don't even try - you'll almost certainly break your app if
you do.
Ordinarily, I wouldn't care (and it wouldn't matter either), but this form
is posting to a Paypal server and PayPal is expecting particular field
names - so consequently we are having problems.
Ah yes - a familiar problem...
A workaround would be to use a placeholder, and use .innerHTML to inject
straight HTML inside. But this entire piece of code is already a
workaround
for .NETs inability to handle multiple forms, so I thought there must be a
limit to the amount of messing about that I have to do.
Regrettably, I don't know any other way of doing what you're trying to do so
long as you continue to use form submission.
Obviously, form submission isn't the *only* way to interface with PayPal...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:eh******** ******@TK2MSFTN GP05.phx.gbl...
>
Correct. That is standard behaviour.
Agreed - I just wasn't sure whether 'standard' meant 'only' behaviour. It
does.
>Is there a way that I can force the server not to change the name of the fields?
Absolutely not! Don't even try - you'll almost certainly break your app if
you do.
Any more than a succession of workarounds?
It's frustrating that, while .NET is leagues ahead of Classic ASP in almost
every other area, it still manages to shoot itself in the foot in this way.
>
Obviously, form submission isn't the *only* way to interface with
PayPal...
No, but it is the simplest and easiest, especially for the way in which I am
using it. I will be looking into the other APIs and mechanisms in good time,
but in the short term I will persist with this.
It's not the end of the world, but it's a shame.
C'est la vie!
Thanks
Chris
"CJM" <cj*****@remove me-yahoo.co.ukwrot e in message
news:6j******** ****@mid.indivi dual.net...
>>Is there a way that I can force the server not to change the name of the fields?
Absolutely not! Don't even try - you'll almost certainly break your app if you do.
Any more than a succession of workarounds?
A workaround isn't supposed to break your app, not even a succession of
them...
It's frustrating that, while .NET is leagues ahead of Classic ASP in
almost every other area, it still manages to shoot itself in the foot in
this way.
The munging of control identifiers is necessary to allow things like
nesting, MasterPages and other UserControls to co-exist etc...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:ur******** ******@TK2MSFTN GP03.phx.gbl...
>> Any more than a succession of workarounds?
A workaround isn't supposed to break your app, not even a succession of
them...
Every bit on 'unneccessary' code makes it harder to maintain and makes bugs
more likely - as well as making development more of a chore.
In this case, the working solution is only slightly more clumsy than my
first attempted method, but it's the principle that I feel like I'm fighting
*against* the system rather than working *with* it.
Still, it's been an education - which is half of the objective.
>
The munging of control identifiers is necessary to allow things like
nesting, MasterPages and other UserControls to co-exist etc...
I realise that; but couldnt there be some sort of override? It's a very
useful feature in general, but in this case, I'd rather be allowed to trust
my own naming judgements.
On Sep 23, 4:07*am, "CJM" <cjmn...@remove me-yahoo.co.ukwrot e:
I have a bit of code that inserts some extra controls (specifically,
ordinary <input type="hidden" name="MyField"f orm fields) into an existing
HTML form. However, it is mangling the name & IDs of these controls when
they are rendered:
For example, the PPItemName field is rendered as: <input
name="ctl00$Mai nBodyContent$PP ItemName" type="hidden"
id="ctl00_MainB odyContent_PPIt emName" />
<snip>
I can understand that .NET needs to use the ID attribute, but why the name
attribute? The name attribute is important in standard HTML, but I wouldn't
have thought so for .NET.
A workaround would be to use a placeholder, and use .innerHTML to inject
straight HTML inside. But this entire piece of code is already a workaround
for .NETs inability to handle multiple forms, so I thought there must be a
limit to the amount of messing about that I have to do.
Is there a way that I can force the server not to change the name of the
fields?
Hi. Have you tried something like ...
HtmlGenericCont rol hid = new HtmlGenericCont rol("input");
hid.Attributes. Add("type", "hidden");
hid.Attributes. Add("id", "MyField");
hid.Attributes. Add("name", "MyField");
this.Form.Contr ols.Add(hid);
Even in a content page, for example, the input tag renders in the form
without any ID or name mangling:
<input type="hidden" id="MyField" name="MyField"> </input>
--
Ben http://allben.net/
"Ben Amada" <be*******@gmai l.comwrote in message
news:99******** *************** ***********@a2g 2000prm.googleg roups.com...
On Sep 23, 4:07 am, "CJM" <cjmn...@remove me-yahoo.co.ukwrot e:
Hi. Have you tried something like ...
HtmlGenericCont rol hid = new HtmlGenericCont rol("input");
hid.Attributes. Add("type", "hidden");
hid.Attributes. Add("id", "MyField");
hid.Attributes. Add("name", "MyField");
this.Form.Contr ols.Add(hid);
Even in a content page, for example, the input tag renders in the form
without any ID or name mangling:
<input type="hidden" id="MyField" name="MyField"> </input>
Thanks Ben, I'll look into this...
My current code is:
Dim oItemName As New HtmlInputHidden With _
{.ID = "PPItemName ", _
.Name = "item_name" , _
.Value = Me.EventName.Va lue & " [" & Me.Location.Val ue & " - " &
Me.EventDate.Va lue & "]"}
Me.divPPDetails .Controls.Add(o ItemName)
I'm curious as to why a HTMLGenericCont rol would work OK, but not an
HTMLInputHidden .... Any ideas?
Chris
This works great, Ben. but why?
Thanks anyway.
Chris
CJM wrote:
This works great, Ben. but why?
Glad to hear that works. Off hand, I don't know the exact reason why the
ID/name is changed for HtmlInputHidden .
HtmlInputHidden along with its siblings (HtmlInputText, HtmlInputButton etc)
are form controls that would typically be included in postback data.
ASP.NET may need to be able to uniquely identify each form control by its
ID. Whereas the value in a HtmlGenericCont rol is not passed back to the
server in the form's post data. So it is probably not necessary for it to
have a unique ID.
Ben Amada wrote:
Whereas the value in a HtmlGenericCont rol is not passed back to the
server in the form's post data. So it is probably not necessary for it
to have a unique ID.
Actually, when the tag name for the HtmlGenericCont rol is a form control
tag, like <input>, the value is passed back to the server in a form post.
If you were to have multiple HtmlGenericCont rol "input" controls with the
same ID, the browser will send each piece of data to the server with the
same ID (I just checked). So you would want to avoid that situation. I
guess ASP.NET lets you manage HtmlGenericCont rol elements on your own :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kathryn |
last post by:
Hiya
I have a problem with using some client side and server side scripting
together in an ASP. I'm using VBScript.
What I'm trying to achieve is this -
- Page loads up and some server side vbscript reads the database and
populates a listbox on the page with the first field from each record
in the recordset. This works fine.
- User selects an option on the listbox and, using the OnChange, I
|
by: ij |
last post by:
Hi,
I'm trying to submit an image object, along with some other text fields to
another web server from within an ASP page but am stuck on getting the image
to be submitted with the form.
In a bit more detail:
1. When this particular page is executed, I want the server to pull an image
from a db (stored as a BLOB) along with a few other text fields. This part
is easy and I have no problems with it.
|
by: David W. Fenton |
last post by:
A client is panicking about their large Access application, which
has been running smoothly with 100s of thousands of records for
quite some time. They have a big project in the next year that will
lead to a lot of use of the database and the adding of quite a lot
of new data (though I can't conceive of them adding more than than
10s of thousands of records, which won't change the current
performance profile at all).
If there is a SQL...
|
by: Francois |
last post by:
Hi,
I have a form which contains some non server side controls.
I have seen in the generated HTML of a page that non server side controls
can be read by the server code (C# or VB.NET) as the the ASP.NET framework
itself generated non server side hidden fields used for the postaback.
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
|
by: Donald Grove |
last post by:
Is it possible to retrieve field properties from a table in access2000
using code?
I have tried:
"
dim dbs as dao.database
dim tbl as dao.tabledef
dim fld as dao.field
dim prop as dao.property
| |
by: Mr Newbie |
last post by:
I was thinking about developing a workflow application yesterday and was
musing over the different approaches than one could take in restricting
specific actions on a ticket( Form ) at any said stage.
One approach I have used on other systems is to prevent the action buttons
appearing. For example, if one did not have the Role of Administrator, one
would be prevented from deleting a ticket not created by oneself.
However, it did occur...
|
by: h7qvnk7q001 |
last post by:
I'm trying to implement a simple server-side form validation (No
Javascript). If the user submits a form with errors, I want to
redisplay the same form with the errors highlighted. Once the form is
correct I need to submit to another page that uses the form data.
I first tried making the form submit action= field point to the same
file. When the form was correct, I tried loading the next page by using
<META http-equiv refresh>. But...
|
by: JimmyKoolPantz |
last post by:
IDE: Visual Studio 2005
Language: VB.NET
Fox Pro Driver Version: 9.0.0.3504
Problem: I currently have a problem altering a DBF file. I do not get
any syntax errors when running the program. However, after I alter the
table and open microsoft excel to look at any changes; I get the
following error: "This file is not in a recognizable format" If I do
open the file in excel it looks like its not formatted.
|
by: graphicssl |
last post by:
Okay, so first of all, I'm a designer first and a light coder second (I'm only really trained with HTML and CSS). So I apologize for having to post about something that's probably super-trivial!
I'm working on setting up a shopping cart for a one-product web site, and I'm using HTML and CSS, with ASP for the shopping cart. The ASP takes the information from the form on the shopping cart, and formats it in to two e-mails: one for the company...
|
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,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |