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