2008年12月16日星期二

Re: [fw-mvc] Zend Form: I can't seem to set the name attribute!

The "name" attribute is allowed in HTML4 but has been deprecated in XHTML1.0.

"Note that in XHTML 1.0, the name attribute of [aappletformframeiframeimg, and map] is formally deprecated, and will be removed in a subsequent version of XHTML."


-Hector


On Tue, Dec 16, 2008 at 5:21 PM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- maxarbos <maxarbos@yahoo.com> wrote
(on Tuesday, 16 December 2008, 04:40 PM -0800):
> Is this for real?
>
> There are 1000s of scripts that reference the form name to do javascript
> actions and such.

They reference the DOM _id_, not the name.

> How should something that needs a reference to a form name work then?

You *can* reference it using JS without issues -- use the id attribute
-- which you can set using setName() or by setting the id attribute.

That said, somebody posted a misleading issue in the tracker. The "name"
attribute *is* allowed:

   http://www.w3.org/TR/html401/interact/forms.html#h-17.3

That said, it's _deprecated_ in favor of the "id" attribute, as this
note (which follows that section) clearly explainss

   This attribute names the element so that it may be referred to from
   style sheets or scripts. Note. This attribute has been included for
   backwards compatibility. Applications should use the id attribute to
   identify elements.


> Matthew Weier O'Phinney-3 wrote:
> >
> > -- rollockg <gina-marie.rollock@ntsinteractives.com> wrote
> > (on Monday, 01 December 2008, 08:17 AM -0800):
> >>
> >> I have tried to set the name attribute in Zend Form both by using the
> >> setName
> >> and the setAttrib methods. All I get is id="name", but no name attribute.
> >> I
> >> am using 1.7.
> >
> > The HTML specification does not allow for a "name" attribute for forms.
> > setName() on the form will set the id (unless you explicitly set the
> > id) -- which is what you are seeing here. setName() exists so that there
> > is a consistent API across the Zend_Form classes.
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect       | matthew@zend.com
> > Zend Framework           | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Zend-Form%3A-I-can%27t-seem-to-set-the-name-attribute%21-tp20774499p21045031.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/


没有评论: