diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs
index a73cf845..a4146d33 100644
--- a/yesod-form/Yesod/Form/Fields.hs
+++ b/yesod-form/Yesod/Form/Fields.hs
@@ -292,6 +292,7 @@ searchField autoFocus = Field
|]
when autoFocus $ do
+ -- we want this javascript to be placed immediately after the field
[WHAMLET|\
|]
addCassius [CASSIUS|