Flat-ui select dropdown is not functioning - html

I am using Flat-UI (http://designmodo.github.io/Flat-UI/) to aid with the front-end elements of a small MeteorJS App I am building.
The problem I am having is that the Select Dropdown is not working. And I would like to know how to get the option value.
Please see the below Markup:
<div class="select2-container form-control select select-primary" id="s2id_autogen1">
<a href="javascript:void(0)" class="select2-choice" tabindex="-1">
<span class="select2-chosen" id="select2-chosen-2">My Profile</span>
<abbr class="select2-search-choice-close"></abbr>
<span class="select2-arrow" role="presentation">
<b role="presentation"></b>
</span>
</a>
<label for="s2id_autogen2" class="select2-offscreen"></label>
<input class="select2-focusser select2-offscreen" type="text" aria-haspopup="true" role="button" aria-labelledby="select2-chosen-2" id="s2id_autogen2">
</div>
<select class="form-control select select-primary" data-toggle="select" tabindex="-1" title="" style="display: none;">
<optgroup label="Profile">
<option value="0">My Profile</option>
<option value="1">My Friends</option>
</optgroup>
<optgroup label="System">
<option value="2">Messages</option>
<option value="3">My Settings</option>
<option value="4">Logout</option>
</optgroup>
</select>
This is what we have in flatui document. But the select dropdown is not functioning, can someone help me to make it work and pull value from the options?

We have made a custom select due to the inability of styling the system one. It is based on the Select2 plug-in with the source slightly modified to meet Bootstrap naming convention.
Select2 3.5.2
Check this:
http://select2.github.io/select2/
$("#selectList")
.on("change", function(e) { log("change "+JSON.stringify({val:e.val, added:e.added, removed:e.removed})); })

If you read the documentation well you will notice you have manually add a select2 call to transform all selects.
E.g. like this:
$( document ).ready(function() {
$("select").select2({dropdownCssClass: 'dropdown-inverse'});
});

Related

How to write HTML? [dependent drop down list using Material Design Components]

I'm a beginner in coding.
I would like to make dependent drop down list using Material Design Components.
I read official tutorial here.
https://material.io/develop/web/components/input-controls/select-menus/
However, I couldn't find how to write html.
This is the original html file which I wrote.
<div class="pulldownset">
<!-- ========================================== -->
<select class="mainselect" name="language">
<option value="">language</option>
<option value="en-US">US</option>
<option value="en-GB">GB</option>
</select>
<!-- ================================================================ -->
<select id="en-US" class="subbox" name="voiceId[]">
<option value="">voice</option>
<option value="en-US-Wavenet-A">en-US-Wavenet-A</option>
<option value="en-US-Wavenet-B">en-US-Wavenet-B</option>
</select>
<!-- ================================================================ -->
<select id="en-GB" class="subbox" name="voiceId[]">
<option value="">en-GB</option>
<option value="en-GB-Wavenet-A">en-GB-Wavenet-A</option>
<option value="en-GB-Wavenet-B">en-GB-Wavenet-B</option>
</select>
</div>
I read https://material.io/develop/web/components/input-controls/select-menus/ and tried to write new html file, but couldn't.
I came up with some questions.
Is "data-value" different from "name"? Material Design Components
don't have and , do they?
<div class="mdc-select">
<div class="mdc-select__anchor demo-width-class">
<i class="mdc-select__dropdown-icon"></i>
<div class="mdc-select__selected-text"></div>
<span class="mdc-floating-label">language</span>
<div class="mdc-line-ripple"></div>
</div>
<div class="mdc-select__menu mdc-menu mdc-menu-surface demo-width-class">
<ul class="mdc-list">
<li class="mdc-list-item mdc-list-item--selected" data-value="" aria-selected="true"></li>
<li class="mdc-list-item" data-value="en-US">
en-US
</li>
<li class="mdc-list-item" data-value="en-GB">
en-GB
</li>
</ul>
</div>
</div>
I searched the Internet "dependent drop down list using Material Design Components". However, I couldn't get an answer. Am I missing the point?
Could you give me any information or suggestion?
Thank you in advance.
Sincerely, Kazu

How to fix my Drop Down to make it disable a component according to selection

I am building an Angular application and using reactive forms. I am currently working with a form that handles multiple inputs and dropdowns, The problem is that i would like to disable the dropdown according to very specific requierments.
I have tried using ngIf directives inside my template however, i couldn't make it work and it seems that the best approach is to do it programmatically.
The problem is split into two:
1- There are 2 dropdowns wrapped together and they represent "hours" and "minutes", the point is, if the user selects the maximum hour, the minutes should be disabled (which i have done already) by subcribing to value change.
2- I am trying to find a way to do the same thing without repeating the same function i did for the hours.
This is what i have so far (first working solution)
this is in the add-edit-tank
onTimeChange() {
this.tankForm.get('hours').valueChanges.subscribe(selectedHour => {
if (selectedHour == '124') {
this.tankForm.get('minutesCounter').disable();
} else {
this.tankForm.get('minutesCounter').enable();
}
});
}
And the following is the code in my HTML.
<div class="field">
<div class="control">
<label for="hours" class="label"
>Select the hours and minutes</label
>
<div class="select is-test">
<select
class="form-control"
id="hours"
formControlName="hours"
#hr
>
<option value="" disabled selected>Select Hours</option>
<option
value
*ngFor="let index of counter(32); let i = index"
[value]="i * 4"
>
{{ i }}
</option>
</select>
</div>
<div class="dropdown is-hoverable">
<div class="select">
<select formControlName="minutesCounter" #min>
<option value="" disabled selected>Select Minutes</option>
<option
*ngFor="let minute of minutesCounter"
[value]="minute.id"
>{{ minute.minutes }}</option
>
</select>
</div>
</div>
</div>
The expected result is the following:
When the user selects 0 hours and 0 minutes, i would like to disable the hours drop down and remove (0) from the minute select drop down.

VBE IE Dropdown Selection Call

I'm facing an issue with one part of my code. Namely, situation where I am unable to select options from the "widget dropdown menu". I have tried calling the ID and classname with no success (no errors but also nothing is happening).
My VBA:
IE.document.getelementbyid("orgSelection").Focus
IE.document.getelementbyid("orgSelection").selectedindex = 2
IE.document.getelementbyid("orgSelection").FireEvent "onchange"
I have tried this (but also no luck):
IE.document.getelementbyid("orgSelection").Value = "Cats"
I have tried advice from here as well
Source code from IE:
<div class="ui-widget uiWidgetDiv">
<input class="onSubmitValue" id="onSubmitValue" type="hidden" value="selectedOrg">
<input class="statusValue_orgName" id="statusValue_orgName" type="hidden" value="">
<input name="selectedOrg" class="statusValue_orgID" id="statusValue_orgID" type="hidden" value="">
<select class="regular" id="orgSelection" style="display: none;">
<option value="">--Select--</option>
<option value="Cats">
Cats
</option>
<option value="dogs">
dogs
</option>
<option value="--ALL--.issuer">
--ALL--
</option>
<input class="regular ui-autocomplete-input ui-widget ui-widget-content ui-corner-left" style="width: 195px;" placeholder="--Select--" autocomplete="off"><button tabindex="-1" title="Enter minimum 3 characters or more to narrow search results.
Only first 500 organizations displayed." class="ui-button ui-widget ui-button-icon-only ui-corner-right ui-button-icon" type="button"><span class="ui-button-icon ui-icon ui-icon-triangle-1-s"></span><span class="ui-button-icon-space"> </span> </button><input class="onlyAll" id="onlyAll" type="hidden" value="1">
Can you please advise?
PS. The "Cats" and "dogs" are held in a dropdown menu which is referred to (in web source code) as "ui widget" - not sure if that supports the approach?
I have solved it:
'calling dropdown to open
IE.Document.GetElementsByClassName("ui-button ui-widget ui-button-icon-only ui-corner-right ui-button-icon")(0).Click
'selecting first option from the dropdown
IE.Document.GetElementsByClassName("ui-corner-all")(1).Click
There was no need to "execute" or send ~Enter to progress with the selection as the widget automatically uploaded data.

Semantic UI dropdown not able to disable using select input + AngularJS

I'm trying to disable a dropdown depending of a value of a different input. I'm working with Semantic UI and Angular.
This is my HTML
<select class="ui search dropdown" ng-attr-id="{{'dd-' + question.id}}"
ng-options="option.value as option.text for option in question.options"
ng-model="question.answer"
ng-disabled="!question.isEnable">
</select>
And this is how is rendered
<div class="ui search dropdown ng-pristine ng-untouched ng-valid selection">
<select ng-attr-id="{{'dd-' + question.id}}" ng-options="option.value as option.text for option in question.options" ng-model="question.answer" ng-disabled="!question.c_questionIsEnable" id="dd-483" disabled="disabled">
<option value="" class="" selected="selected"></option>
<option label="Yes" value="string:213">Yes</option>
<option label="No" value="string:214">No</option>
<option label="Does not apply" value="string:547">Does not apply</option>
</select>
<i class="dropdown icon"></i><input class="search" autocomplete="off" tabindex="0">
<div class="text"></div><div class="menu transition hidden" tabindex="-1">
<div class="item selected" data-value="string:213">Yes</div>
<div class="item" data-value="string:214">No</div>
<div class="item" data-value="string:547">Does not apply</div>
</div>
</div>
As you can see in the rendered code the disabled attribute is present in the <select>,
nevertheless the dropdown is not disabled. Reading the Semantic UI docs, there is a way to set a dropdown in a disable state using the css class disabled but is not working either (the css class is added to the <select>)
HTML code with using class
<select class="ui search dropdown" ng-attr-id="{{'dd-' + question.id}}"
ng-options="option.value as option.text for option in question.options"
ng-model="question.answer"
ng-class="{'disabled': !question.isEnable}">
</select>
Indeed, the class disabled is added to the select input but the dropdown is not disabled, using Chrome Dev Tools, the element gets disabled if I add the class in the following line
<div class="ui search dropdown ng-pristine ng-untouched ng-valid selection disabled">
Is there a way for make this work using <select>?.
Thanks in advance.
There is an easy way to do this.
Wrapping the in a with the field css class, and use the ng-class attribute in there.
Hope this could help.
<div class="ui field" ng-class="{'disabled': !question.isEnable }">
<select class="ui search dropdown" ng-attr-id="{{'dd-' + question.id}}"
ng-options="option.value as option.text for option in question.options"
ng-model="question.answer">
</select>
</div>

ng-click functions not firing inside html select element

I have the following html dropdown in an Angular view:
HTML
<select>
<option value="Func 1">
<button class="btn ui-button ui-widget ui-state-default ui-corner-all" ng-click="callFunc1()">
<span class="btn-icon add"></span>
Func 1
</button>
</option>
<option value="Func 2">
<button class="btn ui-button ui-widget ui-state-default ui-corner-all" ng-click="callFunc2()">
<span class="btn-icon add"></span>
Func 2
</button>
</option>
</select>
JS
$scope.callFunc1= function() {
alert('func 1');
};
$scope.callFunc2 = function() {
alert('func 2');
};
My problem is the functions attached to the ng-clicks aren't firing.
Can anyone tell me why?
I would suggest following something similar to this format. How you decide to pass around the data is completely up to you, but this should provide some guidance.
<div ng-controller="testCtrl">
<!--js-->
<script>
app.controller('testCtrl',function($scope){
$scope.selectValue = undefined;
$scope.event = function(){
console.log($scope.selectValue)
}
})
</script>
<div>
<select ng-model="selectValue" ng-change="event()">
<option value="test">something</option>
<option value="test2">something2</option>
</select>
</div>
</div>
Make sure all html is within your controller and that you've initiated the body of your html with ng-app (not shown above). ng-change will fire the expression that you pass it when you make a change to the select input. Also, ng-change requires that you assign an ng-model value to your element.