Simple example
In the first example, we will create a form, and initialise the datepicker widget. It should be noted that you can do many more things than just
form widgets and validation with PAX, but this makes a fine first example.
We start with a simple form:
<form name='valForm' method='post'>
<label for='name'>Name</label><input name='name' id='name' type='text' value=''/><br/>
<label for='dob'>Date of birth</label><input name='dob' id='dob' type='text' size='30' value=''/><br/>
</form>
<label for='name'>Name</label><input name='name' id='name' type='text' value=''/><br/>
<label for='dob'>Date of birth</label><input name='dob' id='dob' type='text' size='30' value=''/><br/>
</form>
pax.load.onloaded( function() {
pax.widget.datePick.init( $('dob'), { dateFormat: 'd-m-Y' } );
} );
pax.widget.datePick.init( $('dob'), { dateFormat: 'd-m-Y' } );
} );
Now you're probably wondering: what the heck is "pax.load.onloaded"? Well, when you load a HTML page into a browser, you must wait till the DOM has loaded, before executing DOM based scripting. As such, PAX has a small function to do this for us.
Well, that example wasn't too hard, was it!? Read on for a more substancial example!