Reputation: 15057
I have a modal with an empty action=""
which I am updating with javascript like this
document.edit_matrix.action = '/matrix/' + id;
When I open the modal the changed action is there:
<form id="edit_matrix" name="edit_matrix" method="post" action="/matrix/3">
And then I click on submit and it tries to post on this current page.... It's simply an awful feeling :disappointed: What is wrong? What do I need to change to make this work? It tries to post to this:
POST https://global.test.loc/matrixes 405 (Method Not Allowed)
This is the DOM after attribute update
Update:
Now I tried to hardcode the action like this:
<form id="edit_matrix" action="/matrix/2" name="edit_matrix" method="POST">
and when I click submit button, nothing happens.... it's just dead
OK, I fixed that one... the type of the button was just button and not submit, but it's still not working Tries to submit to original page.... action attribute doesn't change.
Update:
It works now... the button was inside the form partial and I just removed it out of the form partial to create and edit view and now it works.
Upvotes: 1
Views: 461