Form not working correctly when embedded on webpage