Skip to content

Conversation

@fglueck
Copy link

@fglueck fglueck commented Nov 21, 2025

allows something like this:
FormDataJson.toJson($(':input:not(.no_filter,button,[name="pool[]"])','#filter'),{includeDisabled: true, uncheckedValue: 0})

allows something like this:
FormDataJson.toJson($(':input:not(.no_filter,button,[name="pool[]"])','#filter'),{includeDisabled: true, uncheckedValue: 0})
@brainfoolong
Copy link
Owner

Hi. Thanks for your PR. Unfortunately, this is not something i can merge.

First, it contains bugs checkEl instanceof Object but Object has not length attribute.

Second, it is not supposed to work like that. Such a feature is already implemented with an option parameter. To filter out any inputs from the list, you can use inputFilter to reduce the list of elements. Example -> https://github.com/brainfoolong/form-data-json?tab=readme-ov-file#read-form-input-values-but-filter-out-for-example-all-password-fields

@fglueck
Copy link
Author

fglueck commented Nov 25, 2025

Argh... sorry, thats true. But I don't want to filter Elements, I want to generate a json about different elements from different scopes.
Like this:
$('#filterelemente :input, table.hdr :input')

@brainfoolong
Copy link
Owner

I understand. I will think about another solution that do not create a bit of an ambiguous state by this kind of type checking.

Currently your change, even if the bug is fixed, does expect that when jQuery object is passed, it always think just one element is required to be a form, but that's not good, because it blocks all the cases where you can pass a single input.

It will need some time for it, but there will be a solution, sooner or later.

Refactor input handling to support jQuery objects and improve clarity.
Refactor input handling to support array of elements.
@fglueck
Copy link
Author

fglueck commented Nov 25, 2025

Now, it is possible that checkEl is a already a array (list of elements) or an jquery array or old behavior....

@brainfoolong
Copy link
Owner

Now you actually introduced a new bug when just passing a normal string (selector).

Don't bother fixing it, i'll implement another logic.

@fglueck
Copy link
Author

fglueck commented Nov 25, 2025

I am ashamed, I tested only with array and jquery elements...

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