Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Webrat coult not find field
3 Posts
Webrat coult not find field


When I write this step in the scenario: When I select "October 5, 2009" as the "Start date" date

Webrat raises "Could not find field: "task_start_date_1i" (Webrat::NotFoundError)"

View HTML source shows: Start date

I dont know why webrat adds an "li" postfix to the id of the field and get error. Please help!!!

Thanks, Lam

Webrat is assuming that your start_date field is a date select, which Rails implements as three drop downs: one each for day, month, and year. The "1i" postfix is how Rails manages to combine those three input fields into the single date attribute. This is called multipart parameter assignment; here's a good post about how this works and why: http://www.spacevatican.org/2008/12/3/dates-params-and-you

You'll have to tell Webrat that you're using a single text field as your start_date input element. I'm not sure how you do this, but I'm sure it's possible.

Hi Lam,

Given that your date entry is in a text box, I think what you want is: When I fill in "Start date" with "October 5, 2009"

Enjoy! Bryan

3 Posts
Login to add your message