-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Hi,
It would be very helpful to be able to point up-validate to another URL then the form action (like <form action="/form-result" up-validate up-validate-url="/form-render">).
My use case is as follows:
- I have a form for performing filtering on a page
- The form does not get rendered where the filters are getting applied
- Some form fields needs to get re-loaded (re-rendered) based on other form fields
In more detail it looks like this:
- User navigates to a page where filters can be applied
- a backend (symfony) form is used to handle query params
- clicking on
filter-button a drawer with disabled history gets opened using URL where the form gets rendered - the form action is the form rendering URL
- submitting the form will close the current layer
onsubmit="up.layer.accept();" - the form is setup with
up-validate - a submit button (outside the form using formaction) is pointing to the page where the form needs to be applied on
Now modifying one form field will trigger up-validate making the form re-render using the form rendering action and submitting the form via the button will close the drawer and send the form to the page where the filter will be applied.
BUT submitting the form differently, like via keyboard, will submit the form rendering page instead.
If I would be able to use a different URL for up-validate only I would not need to use differen form actions in the first place and just tell unpoly to use a different URL for validating (aka re-rendering) the form and the logic would be much more straight forward.
This pattern could also be used to workaround #460