Form checking is very important script for getting  valid content. The js is the best way to check validity.
Here from name is "sign_up_form". Input value getting process is document.forms["<form_name>"]["<input_fields_name>"].value;.
Code: