The Forms module from the YUI Gallery provides some extra form functionality, and allows you to describe the Forms module in a simple JSON format.
In this example, we have a form where a user can enter their name and their age. There's also a hidden spy field that does nothing.
This form is represented by the following code:
YUI(LAZR_YUI_CONFIG).use('gallery-form', function(Y) { var form = new Y.Form({ boundingBox: '#form', action : 'none', method : 'post', fields: [ {name : "name", required : true, label : "Name : "}, {name : 'ago', type : 'select', choices : [ {label : 'young', value : 'Young'}, {label : 'old', value : 'Old'} ], label : 'Age : '}, {name : 'spy', type : "hidden"}, {name : 'submit', type : 'submit', label : 'Submit'}, {name : 'reset', type : 'button', label : 'Reset'} ] }); form.render(); });