-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Inline form will not submit #105
Comments
hi, if value was not changed, editable does not submit to prevent extra request. It can be managed by |
This happens when I change the value. What do you mean by "create jsfiddle"? |
jsfiddle allows to demonstrate the issue and quickly find the problem.
I will have a look. |
So, I can't seem to replicate the bug on jsfiddle. And I can't send you to the actual site, since it's internal to our firewall. So here's some more information, maybe a scattershot will hit something... :\ I'm using jQuery 1.9.0, and the Bootstrap tab, collapse, and alert, libraries. The version in the main bootstrap.js file is "bootstrap-transition.js v2.1.1". I have some other custom javascript code, but commenting it out doesn't change anything. The same problem occurs on checkbox, text, and wysihtml5 x-editable types. If I copy the entire source code of the page with the problematic forms on it into a new jquery 1.9.0 jsfiddle's html pane, it acts exactly same as just loading it normally. I'd share this, but it would be pointless since it's calling a hostname local to my machine for the src of the various libraries. Watching the apache logs, I don't see the post url being called at all when I click the submit button. Nor does the javascript console report anything. Entering invalid data doesn't bring up the validation message. Here's a stripped down version that has issues. http://jsfiddle.net/d9Mmx/ It still has the local links, but at least you can see the code. Here's what I managed to make of what you posted: http://jsfiddle.net/xBB5x/478/ Note that it actually works the way it's supposed to. |
|
I have the same problem. I found that by changing line 103 of boostrap-editable.js from
to this:
things work. I found that if my editable was a popover things worked fine. But when I made it I stepped through the code in the debugger and everything looked right. For some reason when the submit button was pushed, the submit did not happen (even though On a lark, noticing how the I'm guessing there some weridness related to |
Thanks tig! That worked for me as well. |
Shouldn't this issue be left open until fixed? FWIW, I did not test that this didn't break something else (for example I didn't test if |
Dunno. I was treating this as a support request. So once things worked, I was happy. Though, now I'm having similar issues with checking checkboxes. So, I guess I'll reopen it... |
I finally tracked down both the original problem, and the checklist problem to an issue with bootstrap-tab.js In bootstrap-tab.js it looks like the following code blocks my clicks: /* TAB DATA-API
* ============ */
$(function () {
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
$(this).tab('show')
})
}) If I do something like the following, I can click the file upload button. But I can't click the submit button or checkbox on the editable element. That's why I'm posting here instead of on Bootstraps issue queue. <!DOCTYPE html>
<html lane="en">
<head>
<meta charset="utf-8">
<title>Testing</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://localhost/resources/bootstrap/css/bootstrap.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://localhost/resources/bootstrap/js/bootstrap.js"></script>
<script src="http://localhost/resources/bootstrap/js/bootstrap-tab.js"></script>
<script src="http://localhost/resources/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.js"></script>
<script>
$(document).ready(function(){
$.fn.editable.defaults.mode = 'inline';
$('#excludedirectoryemail').editable({
type: 'checklist',
pk: 1,
url: '/post',
//mode: 'popup',
name: 'excludedirectoryemail',
source: [
{
value: 1,
text: 'Not Shown'
}
],
emptytext: 'Shown',
params: function(params){
var push = {};
push['uid'] = params.pk;
if(params.value==1)
send = 'true';
push[params.name] = send;
return push;
}
});
$("#edit_photo").on('click',function(e){
e.stopPropagation();
});
})
</script>
</head>
<body>
<div class="tabbable">
<div class="tab-content well">
<div data-toggle="tab" class="tab-pane active">
<form action="http://localhost/index.php/search/do_edit_photo/444838/devedir" method="post" accept-charset="utf-8" class="form-horizontal" id="editphoto" enctype="multipart/form-data">
<div class="control-group">
<label for="photo" class="control-label">Replace Photo</label>
<div class="controls">
<input type="file" name="edit_photo" id="edit_photo" class="input-file">
</div>
</div>
<a href="#" id="excludedirectoryemail" data-type="checklist" class="editable editable-click" ></a>
<div class="form-actions">
<button name="" type="submit" class="btn btn-primary">Save</button>
</div>
</form>
</div>
</div>
</div>
</body>
</html> The magic is the stopPropagation() function on the edit_photo element. How do I do similar to the editable forms? |
Bootstrap Tab http://twitter.github.com/bootstrap/javascript.html#tabs has an .on() event that blocks clicks on form elements inside a div set up to be used by tabs. See the html I posted previously. Elements outside that div, like the x-editable popups, are not blocked. Elements inside it, like inline x-editable forms, are blocked. I was able to make my non-x-editable form work by adding the I assume that adding Note that I can remove @tig's fix when I move the forms outside of the tabbable div. This behavior is consistent in both Chromium and Firefox. |
hmm.. I see that it calls
anyway to stop click propagation in editable form you can add handler in shown event:
maybe I'm too tired today.. but I don't understand how this can help %%) |
Nice. It works on both buttons and checkboxs when I tell it to look at '.editable-input'. Now to see about making it work without having to add an event for every input... |
I am having a similar issue. I tried @tig's fix and it is working for me. My problem are not the tabs but I have bootstrap carousel and have x-editable for the description. I am also using the bootstap-lightbox (https://github.com/djinteractive/Lightbox-for-Bootstrap). I could not find the reason for the same. |
@smehtaCAS if it's not too hard could you make a simplified jsfiddle demonstrating the issue? |
If I use the inline form, it will not submit when I click the submit button. The cancel button works find.
If I use the popup form, it all works fine.
I can't even get it to log anything to the console.
Any troubleshooting tips?
The text was updated successfully, but these errors were encountered: