[dokuwiki] Re: [PATCH] refactored media form to use new form class

  • From: "TNHarris" <telliamed@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 03 Oct 2007 20:54:46 -0400

On Mon, 1 Oct 2007 23:55:44 +0200, "Michael Klier" <chi@xxxxxxxxxxx>
said:
> 
> I have a question also: while digging to the code of inc/form.php I
> noticed that there`re lots of places where class="edit" is hardcoded to
> the elements with a follow-up call to buildAttributes(), so if someone
> would pass an extra attribute class to that call you`ll end up with to
> class attributes (I don`t know if this is allowed by the HTML specs but
> to me it feels wrong)
> 

Yes, as Chris pointed out, duplicate attributes is a bad idea. Just a
bit of short-sightedness on my part.

I've considered, briefly, the advantages of combining extra 'class'
attributes into one, but I couldn't think of case where it would really
be better. Not to mention that it would be more difficult to handle when
a plugin must overwrite the default value.

So default class specification should be moved to the factory function
(form_make*) then merged with the argument attributes.

> Therefore it was necessary to introduce a new function in the form class
> to be able to specify the forms' enctype.  Rather than putting this into
> the constructor I decided it would eventually be better to have a 
> separate function named: setEnctype($enctype).
> 

I would argue that the encoding type is a property of the form, and not
a child. It should probably also be read-write. Just like action,
method, and id.
-- tom
telliamed@xxxxxxxxxxx

-- 
http://www.fastmail.fm - I mean, what is it about a decent email service?

-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: