Text_field_tag question

Hi,

I’m using a text_field_tag to provide a place for user input which does
not need a model or table associated with it. It is used for jQuery to
compare a users input with another field value.
If I place the text_field_tag within the form_for code for the page,
upon data entry it looks for a route which I do not want or need and an
error is generated.

<%= text_field_tag “answer_input”, nil, autofocus: true, placeholder:
‘Enter answer here’ %>

If I place it outside the form_for it works, but then I can’t
position it on the page where I want it very easily.

I am a novice and am wondering if I am either using the wrong type of
input field or really do need to keep it outside the form_for and deal
with its page positioning thru CSS.

Here is additional info…
If I use:

form_for


If I type anything into the text box and hit return, I get same error:
No route matches [POST] “/questions/answer”

Thanks,

Dave C.

Dave C. wrote in post #1155335:

Hi,

I’m using a text_field_tag to provide a place for user input which does
not need a model or table associated with it. It is used for jQuery to
compare a users input with another field value.
If I place the text_field_tag within the form_for code for the page,
upon data entry it looks for a route which I do not want or need and an
error is generated.

Sorry, looks like this is not a Rails problem at all. The form is
submitted when I press the enter key by default so I guess I have to
disable it in jQuery!

Thanks,

Dave C.