Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOTFIX - Ticket 1484 #288

Merged
merged 2 commits into from
Nov 30, 2023
Merged

HOTFIX - Ticket 1484 #288

merged 2 commits into from
Nov 30, 2023

Conversation

droberts-ctrlo
Copy link
Contributor

No description provided.

@abeverley
Copy link
Contributor

Thanks for this Dave, looks good. I would just like to futureproof it for the fields potentially being multiple-select too.

As such, I think it should be possible to change the first line in getData to: const fieldSets = this.el.find('fieldset').

Then I think the condition inside the fieldSets loop will need to be $(field).prop('type') === 'checkbox' || $(field).prop('type') === 'radio' instead of just the checkbox.

And then the fields loop should simply be able to have a condition of !$(field).closest('fieldset').length)

Can you try that and see if it works please?

@droberts-ctrlo
Copy link
Contributor Author

Would this not be redundant due to Line 81 checking fieldsets anyway - if we include a check in there to ignore all fieldsets, we'll lose the changes to text inputs. Would it not be better to change it so that it ignores the fieldsets, and just does the check you've suggested above at line 66 (i.e. if($(field).prop('type') === 'radio' || $(field).prop('type') === 'checkbox' ) {... and disregard fieldsets altogether - whichever way you look at it, the code from line 80 onwards loops all input controls anyway, so removing 59-77 and placing the functionality below would probably reduce the complexity and speed things up (albeit marginally).

@droberts-ctrlo
Copy link
Contributor Author

Would this not be redundant due to Line 81 checking fieldsets anyway - if we include a check in there to ignore all fieldsets, we'll lose the changes to text inputs. Would it not be better to change it so that it ignores the fieldsets, and just does the check you've suggested above at line 66 (i.e. if($(field).prop('type') === 'radio' || $(field).prop('type') === 'checkbox' ) {... and disregard fieldsets altogether - whichever way you look at it, the code from line 80 onwards loops all input controls anyway, so removing 59-77 and placing the functionality below would probably reduce the complexity and speed things up (albeit marginally).

Thinking about it - the checkboxes would need to be within a "push" into an array, not repeated values, so this may not be the best way - although I think the theory is sound!

@abeverley
Copy link
Contributor

I think as a general rule the fieldsets contain multiple input fields (i.e. select-widgets) of which only some may be selected, whereas the other types of fields always need the value of the field regardless. Plus as you say they can have multiple values so they need a push onto the array. (I don't think text inputs would be affected as I don't think they are within fieldsets.)

That said, if you can find a better way to combine it in a neat and tidy way, then please feel free :)

@abeverley abeverley merged commit d722b89 into ctrlo:uiux Nov 30, 2023
5 checks passed
@abeverley
Copy link
Contributor

Thanks Dave, that looks great.

@droberts-ctrlo droberts-ctrlo deleted the HOTFIX-usermodal branch November 30, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants