Closed Arrow7000 closed 8 years ago
I think it's because your edit button does not specify a button type. By default, the button type is submit
. So you are clicking on the button and it's submitting the form since it's a submit button. Try adding type="button"
to your edit button.
Oh wow this actually works. Thanks @ckosloski! :) :+1:
NOTE: I have copied this here from StackOverflow: http://stackoverflow.com/questions/37547037/xeditable-form-is-saving-form-without-even-displaying-it
I have followed the instructions exactly but my form is not working. I want to save a resource, but when I click the Edit button, which should display the form, it seems to skip the editing stage and immediately triggers the saveResource function - which should only happen when the form gets saved.
I've compared my code to the documentation again and again and can't work out what I am doing wrong.
HTML
JS
JSFIDDLE HERE
You can see that it is trying to save the form, because every time the Edit button is clicked, the console logs "Save resource". This should not happen when the edit button is clicked.