Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
Cannot launch CKFinder 3 from a HTML form

I'm trying to use CKFinder 3 in a very simple form like the one below, but when pressing "Browse server" button(s), the CKFinder appears briefly, then the page gets redirected to "save.php" like the submit button was clicked. If I remove <form> and </form> tags, CKFinder opens normally, but I can't submit the form. What I'm missing here? Thanks!

...
<form action="save.php" method="post" >
   <input id="ckfinder-input-1" type="text" >
   <button id="ckfinder-modal-1">Browse Server</button>
      <div style="height: 5px"></div>
   <input id="ckfinder-input-2" type="text" >
   <button id="ckfinder-modal-2">Browse Server</button>
      <div style="height: 5px"></div>
   <button type="submit">Save</button>
</form>
...
<script src="ckfinder/samples/js/sf.js"></script>
<script src="ckfinder/samples/js/tree-a.js"></script>
<script src="ckfinder/ckfinder.js"></script>
<script>

    var button1 = document.getElementById( 'ckfinder-modal-1' );
    var button2 = document.getElementById( 'ckfinder-modal-2' );

    button1.onclick = function() {
        selectFileWithCKFinder( 'ckfinder-input-1' );
    };
    button2.onclick = function() {
        selectFileWithCKFinder( 'ckfinder-input-2' );
    };

    function selectFileWithCKFinder( elementId ) {
        CKFinder.modal( {
            chooseFiles: true,
            width: 800,
            height: 600,
            onInit: function( finder ) {
                finder.on( 'files:choose', function( evt ) {
                    var file = evt.data.files.first();
                    var output = document.getElementById( elementId );
                    output.value = file.getUrl();
                } );

                finder.on( 'file:choose:resizedImage', function( evt ) {
                    var output = document.getElementById( elementId );
                    output.value = evt.data.resizedUrl;
                } );
            }
        } );
    }
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!