10-11-2011 05:47 PM
/* myform_post.ftl */
new Alfresco.dashlet.MyApp("${args.htmlid}").setOptions(
{
"location" : "${location!''}",
"country" : "${country!''}",
}).setMessages(
${messages}
);
//]]>
function setSelectedIndex(s, v) {
for ( var i = 0; i < s.options.length; i++ ) {
if ( s.options[i].text === v ) {
s.options[i].selected = true;
/* s.value = v;
* s.selectedIndex = i;
*/
return;
}
}
}
setSelectedIndex(document.getElementById("${args.htmlid}-country"), "${country}");
:
:
<select name="country" id="${args.htmlid}-country" size="1" >
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
:
</select
10-12-2011 03:57 PM
if (!this.postDialog)
{
this.postDialog = new Alfresco.module.SimpleDialog(this.id + "-configDialog").setOptions(
{
templateUrl: Alfresco.constants.URL_SERVICECONTEXT + "modules/mydashlet/mydashlet-post?mode=edit;
doSetupFormsValidation:
{
fn: function TravelLog_doSetupForm_callback(form)
{
setSelectedIndex = function (s, v) {
for ( var i = 0; i < s.options.length; i++ ) {
if ( s.options[i].text === v ) {
s.options[i].selected = true;
return;
}
}
}
var element = new YAHOO.util.Element('country_value');
var country_text = element.get('value');
setSelectedIndex(document.getElementById(this.postDialog.id + "-country"), country_text);
<input type="hidden" name="country_value" id="country_value" value="${country}" />
<select name="country" id="${args.htmlid}-country" size="1" >
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.