bigin / ItemManager_2.0

ItemManager (IM) is a simple flat-file framework for GetSimple-CMS that allows you to develop completely customizable PHP applications bundled with GetSimple-CMS.
MIT License
5 stars 3 forks source link

Dropdown box fields problems #11

Open mittus opened 6 years ago

mittus commented 6 years ago

If I save empty values with spase (not a  ), in the items, when I try save them, I see error "Invalid value format for the Fieldtype"

bigin commented 6 years ago

I don't understand, could you please describe it better or give more information? Thank you

mittus commented 6 years ago
  1. I create new field, and use space-bar (If I create field with &bpsp;, it have not problem) screenshot_5
  2. When I save any item, I get error: screenshot_7 screenshot_8
bigin commented 6 years ago

Ah yes that I know, unfortunately it is so for the moment, because it trims the spaces when entering the value in the item editor. Can you use   or is there a problem?

mittus commented 6 years ago

Yes, with   I can and it is not problem.

mittus commented 5 years ago

Hello!! How I can use multiple dropdown for select several values?

bigin commented 5 years ago

Hi mittus!

Unfortunately, we currently have no way to accomplish this. You can use a chunk field or write your own field type that allows it.

With a chunk field it should be relatively easy, for example:

  1. Create a text field, name it cars. Give this field area CSS class hidden.
  2. Create a chunk field with default value:
<div class="fieldarea">
<label for="multiple_dropdown">Select Multiple</label>  
<div class="field-wrapper">
<select id="selectMultiple" multiple>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
</div>
</div>
<script>
$(function() {
    var values = $("#cars").val();
    $.each(values.split(","), function(i,e){
        $("select#selectMultiple option[value='" + e + "']").prop("selected", true);
    });
    $("select#selectMultiple").change(function(e) {
        var selected = $(e.target).val();
        $("#cars").val(selected);
        console.log($("#cars").val())
    }); 
});
</script>

Sometime I will extend ItemManager with the new field, unfortunately I don't have time for it now ;-)

mittus commented 5 years ago

Hello!

I need use my own field. Now trying create multiple field. If you have example, give me please.

Thank You!!

bigin commented 5 years ago

Here are the files you can duplicate and customize: imanager/lib/processors/fields/FieldDropdown.php imanager/lib/processors/inputs/InputDropdown.php

Since these fields also implement InputText, take a look at the imanager/lib/processors/inputs/InputText.php file.

And you still have to adjust your backend template file /plugins/imanager/tpl/row.fields.im.tpl.

You can also find more information here: https://ehret-studio.com/articles/itemmanager/itemmanager-fieldtypes/

Good luck! ;-)