update js with validation