durusmail: quixote-users: form2 considerations
form2 considerations
2004-03-01
2004-03-01
form2 considerations
Oscar Rambla
2004-03-01
Hi,

I use form2 framework and have a pair of considerations:

- Population.

I have a  component that decides on construction time from the arguments that
receive wich widget class instantiate and found 3 possible ways to populate
it:

 1. add method works with 2 required arguments:
         .widget Klass argument is important for the component side.
        .Name argument is mandatory for the form.
    Since add requires a widget class as first argument (Klass) this doesn't
seems to be a good candidate.

 2. add_component method seems more appropiate. This one instead requires a
component class as first argument (Klass) but doesn't know anything of form
default component_class.
 3. Add a 3rd method via subclass or not. Since there already are a pair of
such methods that do mostly what is needed, it seems a bit excessive.

Question:
  Is add method the recomended method for population in form2 ? or
  is add_component the (next) prefered and add its maintained for
compatibility reasons to facilitate the migration
  from the form(1) framework that worked with widgets inside the form?

  In my case, wich method recommend?

Suggestions:

  Since both metods are public shouldn't add_component know also about
component_class default?

  Also I suggest to rename Klass argument in 'add_component' and 'add' to a
more descriptive form like
  component_class and widget_class, cause it could be a bit confussing.


- Form submition.

I use GET methods for initialitzation proposes in these situations
when URL parameters/values corresponds to form inputs. Otherwise I use the
'script side' of the URL.
Then I parse the request as ordinarily and it's Ok.
But still need to provide an 'is_submitted' conveniently modified method to
render the form.

I've read several times in the list about troubles with GET method always
involved with initialization proposes.

I'm not an expert on HTTP matter at all, but from a practical point of view:

Since POST is the recomended and default method for form submition in this
framework,
What do you think about GET method requests be defaulted to not submitted?


Answers, comments and corrections welcomed.

Thank you.

Oscar Rambla



reply