Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 4 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2017
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile
Tags:
  • base
  • container
  • css
  • datatable
  • date
  • docs
  • layout
  • tooltip
  • widget

Suggestions: my wishlist

Post Posted: Fri Dec 18, 2009 4:57 am
I liked the component so I looked into it and thought about things I would like to see. This is my wishlist:

Group

There should be FormFields and FormGroups. The abstract FormGroup would be the base for Form <form>, FieldSet <fieldset> plus <legend> and SimpleGroup <div> elements. The later would simply be a group meant to provide an enclosing container for formatting purposes. FormGroups can contain FormGroups and FormFields.

Enclose label and field in a div


It would make laying out easier if the label and the input field are within a div.

className property


A className to apply to the fields would be great. It should be applied to the div enclosing both the label and input control.

Validator should accept Regexp

The validator should take both a function and an instance of a regexp. In fact, most validators are nothing more than the same function with different regexp.

rename US specific validators

date should be dateMdy, postalcode should be USZip, phone should be USPhone. Or, better yet use localization instead of hardcoding it, but that might be tricky.

Use object to store validators.

Once you define the validators, store them in a hash indexed by their shortname, such as:

Code:
Validators = {
        dateMDY: VALIDATE_DATE,
        time,VALIDATE_TIME,
    ....
}


and so on. Then validating the short name for the validator is simply a matter of trying to access the property in this array and if undefined, it doesn't exist. Likewise, setting the validator is no longer a long set of if/else clauses. This also adds the flexibility of adding more validators. This hash should be a static property. See: http://developer.yahoo.com/yui/docs/YAH ... .Formatter

add defaultValue property

showError

A good means of showing error messages is to add a className to the div containing both the label and input field in error. This would make it easy, for example, to add a padding on either side of the label and using a non-repeating background image, plus color changes, all done in CSS. In order to avoid disturbing the layout of the form, the error message could be shown as a tooltip when the cursor is placed on top of the label if the needed components are loaded, or in a div after the input field within the field container div otherwise.

non-input fields

Just plain text with no input whatsoever.

Joe Developer

  • Username: JoeDev
  • Joined: Sat May 09, 2009 12:54 am
  • Posts: 73
  • Twitter: joe_developer
  • IRC: unomi
  • Offline
  • Profile

Re: Suggestions: my wishlist

Post Posted: Mon Jan 04, 2010 1:45 pm
you might want to have a look at inputex : http://javascript.neyric.com/inputex/
yui 2.x mind you, but probably a lot of useful code which can be pulled in.

Greg Hinch

YUI Contributor

  • Username: greghinch
  • Joined: Wed Jun 03, 2009 10:49 am
  • Posts: 74
  • Location: Fairfax, CA , USA
  • Twitter: greghinch
  • GitHub: ghinch
  • Gists: ghinch
  • IRC: gr-eg
  • Offline
  • Profile

Re: Suggestions: my wishlist

Post Posted: Sat Jan 23, 2010 1:15 pm
Thanks for the suggestions Satyam, I've been a bit busy with my regular work and life in general and haven't had much chance to work on this since the holidays, but I'm getting back to it this weekend. This kind of feedback is great to have and I'll work on incorporating it!

Juan Ignacio Dopazo

YUI Contributor

  • Offline
  • Profile
Tags:
  • docs
  • list
  • node
  • number
  • widget

Re: Suggestions: my wishlist

Post Posted: Tue Mar 27, 2012 6:06 am
Hey Greg!

I'm thinking about making a few modifications to gallery-form. At first I'll just send you a pull request with a couple of things missing from the docs (I'll try to rebuild the docs with the new template).

Here are a couple of ideas that I'm considering:
  • Groups like Satyam mentions
  • Exposing some private objects as class properties (ie: child type aliases)
  • Separating validation into extensions
  • Reducing the number of nodes by using the content box as the field node
  • A Widget extension that adds a form to a Widget and relates data to fields (kind of a Model-View thing inside your widget) so that complex Dialogs can be easily built from it
  [ 4 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum