Reputation: 1302
I am currently using php laravel framework and trying to use instantclick for blade template but it disables form submit. I have a form like the one below in a bootstrap modal. I can submit the form on the first load. However, I am not able to submit the form if I move to other page and came back.
<form id="caseNoteForm" class="width-100" method="post" action="{{route("updateNote",["caseNo"=>$case->case_no])}}">
{{method_field("PUT")}}
<textarea name="customerReportNote" rows="10" class="width-100" style="resize: vertical">{{$case->customerReportNote}}</textarea>
<div class="width-100">
<button class="btn btn-success pull-right margin-top-10" value="submit" type="submit">Finalize</button>
</div>
</form>
It seems InstantClick disables jQuery as well. How can I handle this conflict? I've already tried data-no-instant for all scripts I have but it still does not work. Please give me some advice on this
Upvotes: 0
Views: 190
Reputation: 1613
InstantClick does not disable forms. The other way around, it leaves forms alone, any form submission is excluded from InstantClick behavior no matter what you do.
Also, it does not disable jQuery or any other scripts. Conflicts may occur, though! Beware, if you're using Laravel Debugbar, it uses jQuery.noConflict()
which probably causes your issue with the jQuery library - after loading another page, jQuery is no longer accessible as $
or jQuery
. One of the solutions is just to avoid using noConflict()
.
You're right about data-no-instant
- you should use it for each script that should not be loaded on each page change but only once and that is usually the majority of typical scripts. For all the scripts you need to load again on each page change, don't use the attribute and if it's just a part of code, please, use
InstantClick.on('change', function() {
// Do what you need to do on each page change here
});
Upvotes: 1