fixing bug #5614
check if field is mandarory before adding javascript check