With the Dirty Harry Zend Framework wrapper, I wanted to have the ability to do client side validation along with server side validation and submission of form data via ajax. YUI has some of that with the Dialog component, but it has a couple of short comings:
So I ended up writting a Form component that was based on the guts of the Dialog component. It has no user interface, but rather focuses on the behind the scenes items for the following:
The Form component is made up of the following files:
Requires the following YUI (only tested with 2.4.1):
Also makes use of the following if available:
Examples of the use of the Form component can be seen in the screenshots for the RLM web application alpha.
Using the Form component is relatively straight foward:
<form id="test" action="submit.php" actionvalidate="validate.php" method="POST">
<div id="test_buttons"></div>
var form_test = new YAHOO.thZero.Form("form_test",
imageError: "error.gif",
imageRequired: "required.gif",
successReload: true,
buttonSubmit: true,
buttonCancel: true,
buttonDelete: false,
buttonReset: true,
buttonsEl: "test_buttons"
form_test.render(false);
form_test.render(false);
The Form component has quite a few configuration options; see the source.