I have the following Rails form_for definition. As you can see in the screen shot, it is not rendering the "Sign In" text for the Submit input. I have also included the resulting HTML.
<h2>Sign in</h2>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :dojoType => "dijit.form.Form") do |f| %>
<p><%= f.label :login %><br />
<%= f.text_field :login, {:dojoType => "dijit.form.TextBox"} %></p>
<p><%= f.label :password %><br />
<%= f.password_field :password, {:dojoType => "dijit.form.TextBox"} %></p>
<% if devise_mapping.rememberable? -%>
<p><%= f.check_box :remember_me, {:dojoType => "dijit.form.CheckBox"} %> <%= f.label :remember_me %></p>
<% end -%>
<p><%= f.submit "Sign in", {:dojoType => "dijit.form.Button"} %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
HTML
<span class="dijit dijitReset dijitInline dijitButton" dir="ltr" widgetid="user_submit"><span class="dijitReset dijitInline dijitButtonNode" dojoattachevent="ondijitclick:_onButtonClick">
<span class="dijitReset dijitStretch dijitButtonContents" dojoattachpoint="titleNode,focusNode" wairole="button" waistate="labelledby-user_submit_label" role="button" aria-labelledby="user_submit_label" id="user_submit" tabindex="0" style="-webkit-user-select: none; ">
<span class="dijitReset dijitInline dijitIcon" dojoattachpoint="iconNode"></span><span class="dijitReset dijitToggleButtonIconChar">●</span>
<span class="dijitReset dijitInline dijitButtonText" id="user_submit_label" dojoattachpoint="containerNode"></span>
</span>
</span开发者_StackOverflow>
<input name="commit" type="submit" value="Sign In" class="dijitOffScreen" dojoattachpoint="valueNode">
</span>
Your ERB code is correct, it is working fine. It seems you have trouble on main layout. You must add your dojo script definition section. I recommend you to create a clean new layout for this concept. My head is on dojo.html.erb
<%= stylesheet_link_tag "default" %> <%= csrf_meta_tag %> <%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js' , :djconfig => "parseOnLoad: true"%>
Problem is simple, if you check samples on dojo, button is button type, but rails produces input type, so it is not working. You can write on erb file,
<button dojoType="dijit.form.Button" type="button">Click me too!</button>
it is working, or you can write your helper script on application_helper.rb
精彩评论