Take only a portion of the input content without submitting

Asked

Viewed 208 times

1

I am creating an image gallery using the responsivefilemanager plugin and a problem has arisen that I am unable to solve.

Look at this picture:

inserir a descrição da imagem aqui

Clicking the blue button (With the symbol of the folder) opens a Modal in which I can create folders, upload images etc. When I select the folder, the screen closes and the folder path is returned in Input, but I’m having trouble handling it, because I actually wanted only the end of the URL (folder name).

So I ask, how can I resolve this situation? I need to get the value without submitting so I can’t use $_GET ...

Here’s my button code

<div class="col-xs-4  col-md-4">
    <label for="pasta">Pasta:</label>
    <!-- Campo Pasta e Seleção de Imagens-->
    <div class="input-group">
        <span clas="input-group-btn text-center">
            <a href=<?=(Empty($dir))?"/assets/libs/filemanager/dialog.php?type=2&field_id=folder": "/".$dir."/assets/libs/filemanager/dialog.php?type=2?type=2&field_id=folder"?> class="btn btn-info fancy" data-fancybox-type="iframe">
                <i class="fa fa-folder-open-o"></i>
            </a>
        </span>                                     
        <input type="text" placeholder="Pasta" class="form-control" name="folder" id="folder" onchange="buscar('medium')" value="">   
    </div>     
</div> 
  • You are selecting the entire directory ? or file ?

  • Whole directory ! Abs

1 answer

1


By choosing the file, you can use the following Function callback to process the changes you want to make:

function responsive_filemanager_callback(field_id){
    console.log(field_id);
}

Another option would be to use the callback of the modal closing fancybox.

    $("<YOUR-SELECTOR>").fancybox({ 
        afterClose: function() { 
        // adicionar aqui o tratamento para pegar o nome do arquivo e adicionar no campo 
        }) 
    });
  • I’m using funcybox for modal

  • @Diegolela You can do in your script, add an ending after saving $("<YOUR-SELECTOR>"). fancybox({ afterClose: Function() { // add here the treatment to pick up the file name and add in the field }) });

  • thanks buddy! ran hugs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.