You are viewing limited content. For full access, please sign in.

Question

Question

List with "Other" option

asked on February 18, 2015 Show version history

What I'd really like is either a textbox that autofills the most common options, or a dropdown box with an option for "Other" that lets you type in what the "other" is.

 

Is there a way to achieve this using Laserfiche? Or am I out of luck?

2 0

Answer

SELECTED ANSWER
replied on February 18, 2015

In a drop down field when other is checked there isn't a way for new text to be typed in. However you can create a workflow to update the drop down list field. I created one once where there was a text field below the drop down. When they selected other and then typed in what they needed in the drop down workflow would then use the "append list field choices" activity to update the list field. In my case it went through an approval process before updating. Once updated then you can assign field values and assign the new drop down list choice to the field and clear the text field. 

3 0

Replies

replied on February 24, 2015 Show version history

This worked out pretty well for me. I wanted the list sorted alphabetically so I ended up using this SDK Script:

protected override void Execute()
{
	// Fields to change
	string templateName = "<template name>";
	string fieldName = "<field name>";
	string newItem = "<new item>";

	// Connect to database (LFSO)
	ILFDatabase db = this.Database;
	LFTemplate temp = (LFTemplate)db.GetTemplateByName(templateName);
	LFTemplateField field = (LFTemplateField)temp.ItemByName[fieldName];
	List<string> listItems = new List<string>();

	// Retrieve existing list items
	bool cont = true;
	int i = 0;
	while(cont) {
		try {
			 listItems.Add(field.Item[++i]);
		} catch {
			cont = false;
		}
	}

	// Don't add if duplicate
	if(!listItems.Contains(newItem)){
		listItems.Add(newItem);
	}

	listItems.Sort();

	field.ClearDropDownList();

	// Add list items back to field
	i = 0;
	foreach(var item in listItems) {
		field.Item[++i] = item;
	}

	field.Update();
}

 

2 0
replied on January 4, 2017 Show version history

Can anyone provide the c# code to add a new value to an existing List using the sdk.

 

 

Thanks

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.