Re: Can an input field have a blank name?

Giganews Newsgroups
Subject: Re: Can an input field have a blank name?
Posted by:  RobG (rgq…@iinet.net.au)
Date: Tue, 06 Sep 2005

Clive Backham wrote:
> I'm having trouble with Instant Payment Notification on PayPal. One of
> the forms that they generate, which invokes one of my scripts, has a
> submit button with a blank name. The HTML fragment  is this:
>
> <input type="submit" name="" value="Continue">
>
> This causes the FORMDATA that is sent to my script to start like this:
>
> =Continue&nextparam=value&....
>
> My initial reaction was that this can't possibly be valid HTML, but I
> put together a brief page including such a field and submitted it to
> W3.ORG's validator, and it was reported as "tentatively valid". So now
> I'm led to believe that having a blank name on an input field is
> valid.

The name attribute is not required for input elements to conform to the
HTML DTD.  The value of the attribute is CDATA, therefore an empty
string is valid.  Therefore not having a name attribute, or having a
name attribute with a value that is an empty string, is valid HTML.

However, a name attribute is required for a form control to be
successful. If it doesn't have a name, its value will not be sent when
the form is submitted.  In your case the name is an empty string, so the
submit button's delimited name/value pair is: &=continue

>
> But how is the received script supposed to parse it? What is the name
> of the field? Is the receiving script expected to just invent some
> random name?

Presumably your receiving script will parse the returned record and
extract name/value pairs.  How you deal with missing names is up to you,
but as Alan suggests, you really need specialist help when it comes to
e-commerce sites and payment systems - they must be utterly bullet-proof.

>
> Thanks for any light anyone can shed on this.

--
Rob

Replies

In response to

Can an input field have a blank name? posted by Clive Backham on Mon, 05 Sep 2005