Requirement- Progressive Enhancement / Full rendering
- Progressive Enhancement: base HTML is provided, and the field rendering is on top of the plain HTMl
- Full Rendering: first render the base HTML, then render additional inputEx elements like label, description, class etc.
- Render RadioField to RadioButton ? should it be supported? perhaps too complex
Progressive Enhancement- Field
- enhance a <input>
- enhance a <div><input/></div>
- Form
- enhance <form> ... any no. of fields </form>
- enhance <div><form> ... </form></div>
Proposal- terminology:
- 'render' the top level method
- 'createField' - for creating DOM nodes
- 'validateDOM' - if 'el' is specified, the validate method checks if it is acceptable
- 'parseDOM'
- 'renderField' - after the DOM nodes are created, it load the default value, check if it's empty and show typeInvite etc.
- upon rendering, detect if an HTML element of required type is existed, e.g. for a Radio Field, it will accept:
<div id="buttongroup1" class="yui-buttongroup">
<input id="radio1" type="radio" name="radiofield1" value="Radio 1" checked>
<input id="radio2" type="radio" name="radiofield1" value="Radio 2">
<input id="radio3" type="radio" name="radiofield1" value="Radio 3">
<input id="radio4" type="radio" name="radiofield1" value="Radio 4">
</div>
src: http://developer.yahoo.com/yui/examples/button/btn_example04_clean.htmlrenderDOM() - if HTML is not present, then render HTML; if HTML element is present, validate it. If valid, then parse it for valid; if not, remove it and re-create it. validateDOM() - parseDOM() - if HTML is present, then parse it to extract attributes such as class. The parse will perform basic validation to remove incompatible attributes renderField() - apply inputEx element, it requires renderHTML() ideas - should the render process store the original nodes? will there be any chance we need to restore it? e.g. restore a RadioField to the original HTML and render as RadioButton? for this case, it is quite unworth. would there be similar case that is useful?
|