fixing bug #5614

check if field is mandatory before adding javascript controls