[jala-dev] AW: Re: Further feedback on jala.Form

  • From: <stefan.pollach@xxxxxx>
  • To: <jala-dev@xxxxxxxxxxxxx>
  • Date: Thu, 10 May 2007 15:20:05 +0200

It would probably have to look like this:
name = label.toAlphanumeric().toLowerCase()

There is an objection: the name is the most important field of the component 
(used for fetching/storing values, for mapping the component at 
form.components, for handling the user input etc). I have a FIXME in my code 
because currently you are able to construct a component without a name and it 
shouldn't be like that. But the label is optional, doesn't exist for all 
components and can only be added once the object has been instantiated.

So my proposal is that the constructor stays this way always requiring a name 
as argument. What we change is jala.Form.create: If this method comes across a 
config element with a label but without a name, it converts the label text to a 
name and uses it to construct the component. After all, it's a helper method.


> -----Ursprüngliche Nachricht-----
> Von: jala-dev-bounce@xxxxxxxxxxxxx 
> [mailto:jala-dev-bounce@xxxxxxxxxxxxx] Im Auftrag von 
> tobias.schaefer@xxxxxx
> Gesendet: Donnerstag, 10. Mai 2007 13:48
> An: jala-dev@xxxxxxxxxxxxx
> Betreff: [jala-dev] Re: Further feedback on jala.Form
> I forgot another thing:
> The lazy programmer inside of me imagines how comfortable it 
> was if jala.Form could derive a component's name 
> automatically from its label declaration, e.g. by lowercasing 
> it and replacing any unwanted characters.
> In the most simple case {label: "Author"} already would 
> produce a text component named "author".
> What do you think?
> Ciao,
> tobi

Other related posts: