I get this error and I donβt know how to solve it. I have read this link before.
EDIT: 1
index.php
<script type="text/javascript"> $(document).ready(function() { $("#customForm").submit(function() { var formdata = $("#customForm").serializeArray(); $.ajax({ url: "sent.php", type: "post", dataType: "json", data: formdata, success: function(data) { switch (data.livre) { case 'tags': $("#msgbox2").fadeTo(200, 0.1, function() { $(this).html('Empty tags').fadeTo(900, 1); }); break; default: $("#msgbox2").fadeTo(200, 0.1, function() { $(this).html('Update').fadeTo(900, 1, function() { $('#conteudo').load('dojo/test_Slider.php'); }); }); break; } } }); return false; }); }); </script>
test_slider.php
<script type="text/javascript"> var slider = []; for (i = 0; i < 5; i++) { slider[i] = ( function(i) { return function() { var node = dojo.byId("input"+[i]); var n = dojo.byId("valores"+[i]); var rulesNode = document.createElement('div'+[i]); node.appendChild(rulesNode); var sliderRules = new dijit.form.HorizontalRule({ count:11, style:{height:"4px"} },rulesNode); var labels = new dijit.form.HorizontalRuleLabels({ style:{height:"1em",fontSize:"75%"}, },n); var theSlider = new dijit.form.HorizontalSlider({ value:5, onChange: function(){ console.log(arguments); }, name:"input"+[i], onChange:function(val){ dojo.byId('value'+[i]).value = dojo.number.format(1/val,{places:4})}, style:{height:"165px"}, minimum:1, maximum:9, } },node); theSlider.startup(); sliderRules.startup(); } })(i); dojo.addOnLoad(slider[i]); } </script>
Problem: the first click in submit btn works well, 5 sliders are imported. Second click, update is supposed, but I get this message:
Tried to register widget with id==valores0 but that id is already registered
[Demo video] 2
source share