I’m making some of our widgets customiser friendly, so they work on the customise page and support widget previews. Usually when you update a widget the save button becomes usable and changes to ‘save and publish’.

However, I’m using some javascript (token input http://loopj.com/jquery-tokeninput/) on the widget text input, so people can select from a list of options in a nice way. The problem is updates to this field don’t trigger the option to save and publish, so there’s no way of saving the changes.

Does anyone have any ideas?

The basic form field is:

<input name="the_token_input" id="" class="the_token_input" value="This will be the token input" /> 

Once you intialise the javascript token input on it a completely new element is created that takes on the input’s role, something like this:

<ul class="token-input-list">
  <li class="token-input-token">Choice 1</li>
  <li class="token-input-token">Choice 2</li>
  <li class="token-input-token">Choice 3</li>
</ul>

Once you make a change it doesn’t affect the original input field, so I’m guessing that’s why the page doesn’t think anything’s been changed…

Read more here: Changes in widget customizer not triggering ‘save and publish’


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: