Using a field with `type="tel"` causes most mobile phone browsers to show a numeric keyboard which makes it easy to enter phone numbers. We aren't using a number field because some browsers show "spinners" to increment/decrement numbers (which doesn't make much sense in a phone number) and because they don't allow characters like spaces. Phone numbers can have characters like spaces, dashes, parenthesis, asterisks, the plus sign, ... Since phone number formats vary depending on the region, and sometimes even within the same region several different formats can be used, for now we aren't offering any kind of format validation. We could offer a format validation that rejects just letters (although there are cases where letters are actually allowed). However, this causes issues at both the server side and the client side. We could use a client-side validation adding a `pattern` attribute to the field, but that would be something unlike anything else we use in the application, and we would need to to write some JavaScript in order to use a proper error message. On the other hand, if we add a server-side validation, we might find out existing users are invalid, and it would be impossible to update them in the many places where we update users assuming they were valid in the first place. We'd have to add a rake task to update existing user records and make sure they contain a valid phone number or create a setting so this validation only applies to new CONSUL installations. Another option would be to add a per-form validation, so the phone number is only validated in pages where it is introduced. All the mentioned scenarios offer certain complexities. So, for now, we're keeping things simple. Co-Authored-By: decabeza <alberto@decabeza.es>
44 lines
1.7 KiB
Plaintext
44 lines
1.7 KiB
Plaintext
<% provide :title do %><%= t("devise_views.organizations.registrations.new.title") %><% end %>
|
|
<h2><%= t("devise_views.organizations.registrations.new.title") %></h2>
|
|
|
|
<%= form_for(resource, as: :user, url: organization_registration_path) do |f| %>
|
|
<%= render "shared/errors", resource: resource %>
|
|
<div class="row">
|
|
<div class="small-12 column">
|
|
|
|
<%= f.fields_for :organization do |fo| %>
|
|
<%= fo.text_field :name, autofocus: true, maxlength: Organization.name_max_length %>
|
|
<%= fo.text_field :responsible_name,
|
|
maxlength: Organization.responsible_name_max_length,
|
|
hint: t("devise_views.organizations.registrations.new.responsible_name_note") %>
|
|
<% end %>
|
|
|
|
<%= f.email_field :email %>
|
|
|
|
<%= f.phone_field :phone_number %>
|
|
|
|
<%= f.invisible_captcha :address %>
|
|
|
|
<%= f.password_field :password, autocomplete: "off" %>
|
|
|
|
<%= f.password_field :password_confirmation, autocomplete: "off",
|
|
label: t("devise_views.organizations.registrations.new.password_confirmation_label") %>
|
|
|
|
<%= f.check_box :terms_of_service,
|
|
title: t("devise_views.users.registrations.new.terms_title"),
|
|
label: t("devise_views.users.registrations.new.terms",
|
|
terms: link_to(t("devise_views.users.registrations.new.terms_link"),
|
|
"/conditions",
|
|
title: t("shared.target_blank"),
|
|
target: "_blank")
|
|
) %>
|
|
|
|
<div class="small-12 medium-6 small-centered">
|
|
<%= f.submit t("devise_views.organizations.registrations.new.submit"), class: "button expanded" %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= render "devise/shared/links" %>
|