Building a Dynamic Form with YUI
September 28th, 2007YUI provides for the creation of forms dynamically without the need for pre-existing markup through the Button object.
Despite its name, the button is a rich widget that supports the creation of:
- Push Buttons
- Link Buttons
- Submit Buttons
- Reset Button
- Checkboxes
- Radios
- Menus
- Split button (hybrid button menus)
Today we are exploring the creation of buttons dynamically from javascript. Creation itself is simple.
The syntax is:
var oButton = new YAHOO.widget.Button({ id: "mybuttonid", type: "button", label: "My Button", container: "someelement" });
Where:
- id = the id of the element to be created
- type = the type of button (push, link, submit, reset, checkbox, radio, menu or split)
- label = the visual label to display
- container = the element in which to append the button.
Id and type are optional, Defaulting to a randomly created ID & "button" respectively.


Previous Post
Next Post

1 Comment
July 25th, 2008 at 2:27 am
I need dynamic form with ajax to store into mysql
Leave a Reply