Form Helper Text_field with datepicker calendar

How do I set an id attribute like id="datepicker" in an input text_field using a form helper.

I tried this:- <%= f.text_field :paid_date, :id="datepicker" %> but it produces an error.

Note that I want <input type="text" name="paid_date" id="datepicker"> as the result, not <input type="text" name="datepicker[paid_date]"> which is all I can find in the API.

Can you not just manage with the default id which should be <model_name>_paid_date I think?

Colin

The jQuery datepicker calendar wants id="datepicker" on the input field.

Mark Horrocks wrote:

Can you not just manage with the default id which should be <model_name>_paid_date I think?

Colin

The jQuery datepicker calendar wants id="datepicker" on the input field.

I found the error, I had omitted a closing ">" on the preceding td element. Now I just have to deal with the calendar wanting to wrap the arrows for month selection :frowning:

Mark Horrocks wrote:

Mark Horrocks wrote:

Can you not just manage with the default id which should be <model_name>_paid_date I think?

Colin

The jQuery datepicker calendar wants id="datepicker" on the input field.

I found the error, I had omitted a closing ">" on the preceding td element.

I strongly suggest using HAML, not ERb, for your views. Besides lots of other advantages, you'll never leave off a > again!

Best,