Update dojo/dijit state?

Vote:
 

I’m using the JQuery tagit- and autocomplete plugins to add tag selection functionality to a textbox in edit mode. When the page is published the tags in the textbox in synchronized to a database. This works fine when the user creates a new tag or select a tag from the autocomplete-list using the arrow keys plus enter but when the user select the tag by mouse clicking on it, it doesn’t work. The tag is added to the textbox in edit mode but the corresponding string property doesn’t contain the newly added the tag when module that does the synchronizing reads it.


So my question is: can I update some internal dojo-state or something to make sure the selected values will be sent to the server when the page is being published?

My code looks like this:

define([
    "dojo/_base/declare",
    "dijit/form/TextBox"
],
function (
    declare,
    TextBox) {

    return declare([TextBox], {
        postCreate: function() {            
           var input = $(this.domNode).find('input');
            input.tagit({
                autocomplete: {
                    delay: 0,
                    minLength: 2,
                    source: '/api/tags',
                    select: function (event, ui) {
                        this.blur(); 
                    }
                },
            });
        }
    });
});
#88350
Jul 09, 2014 11:23
Vote:
 

Hi,

I have the same problem. Anyone, any suggestions?

Best regards
/Anders

#113002
Nov 10, 2014 13:47
Vote:
 

Create a method, onChange, and call it whenever you want to trigger a change. EPiServer will save this value directly and not post the entire form as a traditional forms based application. Ted Nyberg has an example how this is done in his Google Maps editor:

https://github.com/tedgustaf/episerver-google-maps-editor/blob/master/ClientResources/Scripts/googlemaps/Editor.js

#113006
Nov 10, 2014 14:24