Skip to content

Commit

Permalink
Merge pull request #4360 from sharetribe/bug_in_signup_form
Browse files Browse the repository at this point in the history
[Bug] In signup form, error message for custom user fields is in the wrong place
  • Loading branch information
thomasmalbaux committed Mar 19, 2021
2 parents 62dd7e1 + c518974 commit 3286c45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/assets/javascripts/kassi.js
Expand Up @@ -361,7 +361,10 @@ function initialize_signup_form(locale, email_in_use_message, invalid_invitation
//name_required = (name_required == 1) ? true : false
$(form_id).validate({
errorPlacement: function(errorLabel, element) {
if (( /radio|checkbox/i ).test( element[0].type )) {
if ($(element).hasClass("signup-custom-checkbox")) {
var container = $(element).parents('.checkbox-group-container').prevAll('.inline-label-container').first();
errorLabel.insertAfter(container);
} else if (( /radio|checkbox/i ).test( element[0].type )) {
element.closest('.checkbox-container').append(errorLabel);
} else {
errorLabel.insertAfter( element );
Expand Down
2 changes: 1 addition & 1 deletion app/views/settings/custom_fields/_checkbox.haml
Expand Up @@ -7,6 +7,6 @@
- html_id = "person_custom_fields_#{index}_#{opt.id}"
- selected = custom_field_value ? custom_field_value.selected_options.include?(opt) : false
= check_box_tag "#{prefix}[selected_option_ids][]", opt.id, selected,
{id: html_id, class: "custom_field_checkbox #{custom_field.required? ? 'required' : ''}",
{id: html_id, class: "signup-custom-checkbox custom_field_checkbox #{custom_field.required? ? 'required' : ''}",
input_group_id: "person_custom_fields_#{index}"}
= label_tag html_id, "#{opt.title(I18n.locale)}", {class: "light"}

0 comments on commit 3286c45

Please sign in to comment.