0
我有以下問題:設計,黃瓜和多個ID登錄時 - 註冊
我有我的整個網站的登錄表(見https://github.com/plataformatec/devise/wiki/How-To:-Display-a-custom-sign_in-form-anywhere-in-your-app):
# application.html.haml
...
= form_tag new_user_session_path do
= text_field_tag 'user[email]'
= password_field_tag 'user[password]'
%button Login
我想黃瓜測試,如實填寫本人報名表:
# register#new.html.haml
= semantic_form_for resource, :url => registration_path(resource_name) do |f|
= f.inputs do
= f.input :email, :required => true
= f.input :password, :required => true
= f.input :password_confirmation, :required => true
= commit_button("Registrierung absenden")
但是現在有一個問題 - 有我的頁面上兩個字段具有相同屬性ID:USER_EMAIL
當我嘗試填補
# registration_steps.rb
When /^I fill in registration data$/ do |param|
# this one selects the wrong form - loginform instead of registration form
fill_in("user_email", :with => "blabla")
end
登記表中字段的屬性ID是相同的,「FILL_IN」選擇了錯誤的輸入...
我怎麼可能改變IDS與設計一起工作?似乎對我來說太複雜了。
我指出我的問題是否正確?
UPDATE
這是我的渲染註冊站點的一部分:
<html>
....
<!-- you see that both forms contain fields with the same ids! -->
<!-- so when i test f.e. with fill_in("user_login", :with => "123")
then the wrong form will be filled out! -->
<form accept-charset="UTF-8" action="https://stackoverflow.com/users/sign_in" method="post">
<input id="user_login" name="user[login]" size="30" type="text" />
<input id="user_password" name="user[password]" size="30" type="password" />
<input type="submit" value="anmelden" name="commit">
</form>
...
<form accept-charset="UTF-8" action="https://stackoverflow.com/users/sign_in" method="post">
<input id="user_login" name="user[login]" size="30" type="text" />
<input id="user_password" name="user[password]" size="30" type="password" />
<input type="submit" value="anmelden" name="commit">
</form>
...
</html>
的'輸出的問題調試參數'將有助於更好地理解你的問題。 – Zabba 2010-12-14 01:35:45
更新了我的帖子.. – Lichtamberg 2010-12-14 02:00:17