Dynamic Drop Down Menu

I want to create drop down menu , as i created succesfully but i want user to select on one drop down menu and depending on selected item from drop down menu one , drop down menu 2 items populated.

Current problem is:

suppose there are two category “Animals” and “Vehicles”, and Sub categories are “CAT”,“DOG”,“BUS”,“CAR” , so right now issue is whatever i select in category it will display all four sub categories but now i want show sub category depending on Category selection.

code snippet right now is:

@General(title = "XYZ Parser", purpose = "Parse XYZ file", author = "NeosAlpha", docLink = "http://neosalpha.com/")
@Outputs(min = 1, max = 1, offers = ViewType.DOCUMENT)
@Errors(min = 1, max = 1, offers = ViewType.DOCUMENT)
@Version(snap = 1)
@Category(snap = SnapCategory.PARSE)
public class XYZParser extends SimpleBinaryWriteSnap implements DependencyManager {

	private static final String FILE_BROWSER_PROP = "file_browser_prop";
	private static final String XYZ_TYPE_PROP = "XYZ_type_prop";
	private static final String XYZ_TYPE_PROP_VALUE = "Animals";
	private static final String FILE_TYPE_PROP = "file_type_prop";
	private static final String FILE_TYPE_PROP_VALUE = "Vehicles";
	private String filePath;

	private DocumentUtility documentUtility;

	private URLEncoder urlEncoder;

	private JfsUtils jfsUtils;

	String fileBrowser;
	String filetype;
	String XYZtype;
	Map<String, Object> composite;

	public Module getManagedModule() {
		return new AbstractModule() {
			protected void configure() {

	// An optional file selector for providing exchange rates within a file
	public void defineProperties(PropertyBuilder propertyBuilder) {

		Set<String> XYZ_set = new HashSet<String>();
        Set<String> file_set = new HashSet<String>();
		propertyBuilder.describe(XYZ_TYPE_PROP, "XYZ Type",
				"Write XYZ ")
		propertyBuilder.describe(FILE_TYPE_PROP, "File Type",
				"Write File type ")

	public void configure(PropertyValues propertyValues) throws ConfigurationException {
		filetype = propertyValues.getAsExpression(FILE_TYPE_PROP).eval(null);
		XYZtype = propertyValues.getAsExpression(XYZ_TYPE_PROP).eval(null);

	public void cleanup() throws ExecutionException {
		// TODO Auto-generated method stub


	protected void process(final Document document, final ReadableByteChannel readChannel) {
		try (InputStream inputStream = Channels.newInputStream(readChannel)) {

			if(filetype.contentEquals("Animals") && XYZtype.contentEquals("CAT"))
				} else {
			else if(filetype.contentEquals("Vehicles") && XYZtype.contentEquals("BUS") )
			 else {
						// Error Code Here

		} catch (IOException e) {
			errorViews.write(new SnapDataException(e, e.getMessage()), document);
		} finally {





What i want is given below:
For example firstly i select category which are “Animals” or “Vehicles”.
Suppose if i select Animals from category dropdown menu then in next dropdown only selections are shown is “CAT” or “DOG”

Suppose if i select Vehicles from category drop down menu then in next drop down only selections are shown is “BUS” or “CAR”

Just give me code snippet i ll do the rest.
Nikhil Purohit

Hi there,

Looks like you’re attempting to put all possible subcategory selections into one drop down menu, and then hide certain ones. That could get tricky. You may want to do something more UI-tricky, and create two sub category drop down lists. One with animals, and one with cars. The default subcategory can be shown, if you default the main category to say…animals, and then if you make the main category selection, you can hide/unhide the other drop downs accordingly. That may do the trick, but then you have to be careful in your handling code, to key on the enums that you pull out of the subcategory based on the main category. I think the trickiest part here would be the hiding and unhiding of fields.

Make sure that if you go this route, that both dropdown menus are the same size and placement, otherwise the UI might look meh, if you have components on the Snap popping in and out of view, and skewing the placement of other UI components.