User tests: Successful: Unsuccessful:
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
Title |
|
Labels |
Removed:
?
|
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript |
@test success
Needs also the same mods in the compressed file!
Test instructions:
Apply patch
Enable debug
Open /administrator/components/com_content/views/article/tmpl/edit.php
and insert
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 works
Okay, I've updated this pull request. Hopefully that's the correct procedure.
I've not tested this on a real site, but the Travis CI build passed.
This form.classOfForm
doesn’t work. Sorry I should have comment on that before, as I tried that recommendation but I forgot to write about it!
@Fedik @Anibalsanchez can you take a look at this one?
@beat did you mean something like this:
var formClass = jQuery(form).attr("class");
jQuery(form, "."+formClass).submit();
?
in theory should be enough just jQuery(form).submit()
or jQuery(form).trigger('submit');
.
I do not know what the reason to use some tricky formClass
, the form could be without any class
well, I do not see info that can confirm it on http://api.jquery.com/submit/
quick test show that it will not work, and form will be submitted when you trigger submit
event on form
element ... unless I missed something
This allows to prevent the default form submit if wanted
this do not prevent, just try
Maybe something like this can only trigger, and then submit by form.submit()
:
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.
@Fedik @anibalsanchez can you test it? @fredden reverted to the original jQuery(form).submit();
test works good for me
Status | Pending | ⇒ | Ready to Commit |
RTC based on testing Thanks!
Labels |
Added:
?
|
Milestone |
Added: |
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-03-15 16:41:48 |
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
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):
http://api.jquery.com/submit/