-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Dynamically change hx-post #882
Comments
I've managed to make it work! surprisingly, Here is my new code:
|
Hi there, It seems to me that most of the complexity could be removed by having, on server side, sort of a proxy view for all bulk actions, that would just read POSTed value for the <form hx-post="urlForBulkActionsProxy" hx-target="#rewards">
<input type="hidden" name="csrfmiddlewaretoken" value="csrftoken">
<select name="bulk-action-to-perform" class="select form-control custom-select" required="required">
<option value="">----- Bulk actions ----</option>
<option value="delete">Bulk Delete</option>
</select>
<table>
<tbody id="rewards">
<tr id="reward_46">
<td>
<input type="checkbox" value="46" name="reward">
Blablabla
</td>
</tr>
</tbody>
</table>
</form> And you would have no JS at all, am I right? The only thing left to do would be the Django proxy view that would trigger the actual and appropriate bulk action and return the HTML fragment of the updated list of Rewards. But that's piece of cake 😉 |
Thank you! Good idea: I haven't thought about that. This is much more neat. |
Hi,
I try to make a bulk action select input for a list of "rewards".
Here is my HTML :
My JS looks like that:
Here request.POST is an empty dic (I use Django)
I have also tried
Here the POST request is sent to the current page despite the htmx.process
I can't understand what I do wrong on this page https://htmx.org/api/#ajax
The text was updated successfully, but these errors were encountered: