MyTableGrid is a JavaScript based DataGrid control built on the Prototype library. It allows you to display your data in a simple and flexible way.
First you have to include the javascript libraries
<script type="text/javascript" src="../scripts/lib/prototype.js"></script>
<script type="text/javascript" src="../scripts/lib/scriptaculous.js"></script>
<script type="text/javascript" src="../scripts/mtg/myui.js"></script>
Then you define your html input as usual:
<label for="name">Enter a name:</label> <input type="text" id="name" name="name">
Then you create the text field in the following way:
var textField = null;
Event.observe(document, 'dom:loaded', function() {
textField = new MY.TextField({input: 'name',
initialText: 'Enter name',
required: true,
validate : function(value, errors) {
var result = true;
if (value != 'peter') {
errors.push('bad name');
result = false;
}
return result;
}
});
});