adding the validation and javascript functions