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
[#33312] Also calls jQuery events on form submission #3484
Conversation
If you want to do this jQuery-correct way, you should call $(form.classOfForm).submit(); This allows to prevent the default form submit if wanted (e.g. for validations): |
@test success Test instructions: JFactory::getDocument()->addScriptDeclaration('
jQuery(document).ready(function() {
jQuery("#item-form").bind("submit", function() {
console.log("works");
});
});
'); just before ? > at around line 75 Try to create (save) an article, you should get in browsers log |
@fredden Can you update the code as it says that there are conflicts? |
This means that the event listeners in the HTML5-fallback library (which use jQuery) are also triggered. See JoomlaCode issue: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33312
Okay, I've updated this pull request. Hopefully that's the correct procedure. |
This |
Thanks. Ideally I'd have tested before committing. Updated per your example @dgt41, still untested by me. |
@Fedik @anibalsanchez can you take a look at this one?
? |
in theory should be enough just |
well, I do not see info that can confirm it on http://api.jquery.com/submit/ |
That was the exact reason @beat mentioned in the comment above, but I am not sure what he means or how this can be tested! |
this do not prevent, just try 😉 Maybe something like this can only trigger, and then submit by if(jquery){
jQuery(form).submit(function (event) {
event.preventDefault();
});
jQuery(form).submit();
}
form.submit() but I do not see much sense it this 😄 |
I concur, no need of tricky formClass. Besides, I could have to add more classes. |
So @Fedik @anibalsanchez @beat we all agree that this formClass is not needed? |
@Fedik @anibalsanchez can you test it? @fredden reverted to the original |
test works good for me |
RTC based on testing Thanks! This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/3484. |
Do it as a PR please. I manually merged this one due to conflicts and had to triple check myself when merging the compressed file changes; at least a PR (hopefully) has the right changes 😃 |
ok will do that |
This means that the event listeners in the HTML5-fallback library (which use jQuery) are also triggered. See JoomlaCode issue: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33312