As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<div class="form-field"> <script type="text/javascript">//<![CDATA[ YAHOO.util.Event.onAvailable("${fieldHtmlId}_assign", function(){ new selectAuthor("${fieldHtmlId}"); }); function selectAuthor(currentValueHtmlId) { this.currentValueHtmlId = currentValueHtmlId; var selectAuthors = Dom.get(this.currentValueHtmlId); this.register = function () { // Call webscript Alfresco.util.Ajax.jsonGet({ url: Alfresco.constants.PROXY_URI + "/custom/users", successCallback: { fn: this.updateOptions, scope: this }, failureCallback: { fn: function () { }, scope: this } }); }; // Add options into <select> this.updateOptions = function (res) { var result = Alfresco.util.parseJSON(res.serverResponse.responseText); if (result.people.length > 0) { var people = result.people; selectAuthors.options[selectAuthors.options.length] = new Option("", "", true, true); for (var i in people) { var option = new Option(people, people); selectAuthors.options[selectAuthors.options.length] = option; } } }; this.register(); } //]]></script> <label for="${fieldHtmlId}">${field.label?html}:<#if field.mandatory><span class="mandatory-indicator">${msg("form.required.fields.marker")}</span></#if></label> <select id="${fieldHtmlId}" name="${field.name}" tabindex="0" <#if field.description??>title="${field.description}"</#if> <#if field.control.params.size??>size="${field.control.params.size}"</#if> <#if field.control.params.styleClass??>class="${field.control.params.styleClass}"</#if> <#if field.control.params.style??>style="${field.control.params.style}"</#if> <#if field.disabled && !(field.control.params.forceEditable?? && field.control.params.forceEditable == "true")>disabled="true"</#if>> </select> </div>
<div class="form-field"> <script type="text/javascript">//<![CDATA[ YAHOO.util.Event.onAvailable("${fieldHtmlId}", function(){ new selectAjax("${fieldHtmlId}"); }); function selectAjax(currentValueHtmlId) { this.currentValueHtmlId = currentValueHtmlId; var select = Dom.get(this.currentValueHtmlId); alert(); this.register = function () { Alfresco.util.Ajax.jsonGet({ url: "http://localhost:8080/alfresco/service/someco/whitepapers", successCallback: { fn: this.updateOptions, scope: this }, failureCallback: { fn: function(){}, scope: this } }); }; this.updateOptions = function (res) { var result = Alfresco.util.parseJSON(res.serverResponse.responseText); if (result.whitepapers > 0) { var whitepapers = result.whitepapers; select.options[select.options.length] = new Option("", "", true, true); for (var i in whitepapers) { var option = new Option(whitepapers.name, whitepapers.title); select.options[select.options.length] = option; } } else { select.options[select.options.length] = new Option("", "", true, true); var option = new Option("test1", "test2"); select.options[select.options.length] = option; } }; this.register(); } //]]></script> <label for="${fieldHtmlId}">${field.label?html}:<#if field.mandatory><span class="mandatory-indicator">${msg("form.required.fields.marker")}</span></#if></label> <select id="${fieldHtmlId}" name="${field.name}" tabindex="0" <#if field.description??>title="${field.description}"</#if> <#if field.control.params.size??>size="${field.control.params.size}"</#if> <#if field.control.params.styleClass??>class="${field.control.params.styleClass}"</#if> <#if field.control.params.style??>style="${field.control.params.style}"</#if> <#if field.disabled && !(field.control.params.forceEditable?? && field.control.params.forceEditable == "true")>disabled="true"</#if>> <option>test option</option> </select> </div>
.length
if