How to prevent submitting if condition not fulfill