Ok, so you have a nice custom module with a form – now you want to add basic javascript validation to it. Simple. Example,
<input type="text" name="first_name" value="" size="20" class="required-entry input-text" />
The class required-entry will make the field mandatory – this works for text-box and drop down.
If your form appears on the “one page checkout” page then, this is all you need to do.
If your form appears on its own then you will need to add this code at the bottom of your page:
<script type="text/javascript">
var customForm = new VarienForm('my-form-id');
</script>
Ensure that your form name and id are the same and that is what you need to pass to VarienForm




