Option to disable default behavior of including parent form inputs in request
tadaniels opened this issue · 5 comments
I'd like to propose adding the ability to disable the default functionality of including all form inputs from a form that is the parent of the triggering element.
I have bumped into a use case where I have an element contained in a form that triggers an ic-post-to
, but only needs what is contained in the target and not all the inputs contained in its parent form.
Sending along all that form data in this case can make the request heavier than necessary and those extra form parameters are certainly not necessary for the resource to respond appropriately.
Please consider this enhancement.
Thank you!
That's not a bad idea. Something like ic-include-form?
Yep, something like that would be perfect. Maintain the current behavior and keep the default functionality when not provided, but setting that attribute to false would disable the default functionality.
Thanks
Hey There, I was just going through implementing this and I remembered that intercooler doesn't include the closest form values on a GET, under the assumption that we are getting new values that depend only on the given input. That makes a lot of sense thinking about it, and maybe that fact addresses your issue? You aren't mutating anything on the server, right? Just getting a new visual state based on the input value?
I was aware that a GET does not include the inputs from the closest parent form.
I'm using a POST in this case to do some inline validation and parsing of data entered by a user server side. So it isn't mutating anything server side, but doing a GET to perform this validation and responding appropriately doesn't make sense to me. The response in this case returns the validated input element with either success or failure.
So it would still be a nice feature to have for a case like this.
Thanks
In intercooler 2.0, renamed kutty, you can handle this situation by filtering out paramters with the kt-params attribute: