Antd | How can I put a new value in the searchable select? - javascript

I have a searchable select
When I type,
If I search and the value is in options, select the value.
If it is not found, I would like to use the value entered as value.
What should I do?
Help me.
here sendbox
enter link description here

Related

How to have a continuous autocomplete in a text box with other characters/operators between two words?

I am trying to build a formula input text box where as I type into it, it gives me a list of formula metrics, I select it and then add in an operator (+,-,/,...) and then type the name of the second metric and I can select from the list.
For example, in the image below -
As I type For.. it should show me a list of autocomplete suggestions with For prefix.
Then, I enter = sign and no autocomplete is shown.
I type Ma and it shows the list of autocomplete suggestions.
Is there any JavaScript library that does this?

Vue, I want to show different text than selected option from a dropdown

I am new to Vue and I am trying to create a dropdown. this is how it should look, Example Dropdown
When someone selects the percent option then the dropdown should show a % in the selected text field.
and when vehicle count it should show #,
I am currently using el-select to make it work but no success, I am not able to understand how can I replace the selected value with another text in vue without using jquery.

How do I set the selected value of a dropdown in Orbeon Forms using Javascript?

I need to set the selected value of a dropdown control in an Orbeon Form using Javascript, passing in the VALUE (not position) of the required option.
For simple controls (text fields), from the documentation, I can do:
ORBEON.xforms.Document.setValue((ORBEON.jQuery('*[id $= "CONTROLID-control"]')).attr('id'), "NEWVALUE")
And also from the documentation, I can get the selected value of a dropdown using this:
ORBEON.xforms.Document.getValue(ORBEON.jQuery(ORBEON.jQuery('*[id $= "DROPDOWNID-control"]')[0]).find('.xforms-select1')[0])
Actually, that code retrieves the position in the dropdown of the selected value, e.g. "5". But anyway, I couldn't find a way to set the selected value of the dropdown using a VALUE and not a POSITION.
I built my Form using Form Builder and my dropdown is pre-populated using an Action and an HTTP Service. This is my populate action:
https://ibb.co/JsH635s
So I'd like to pass a NAME (value, NOT Position in dropdown) to the selector control to set it as a selected value.
Something like this:
ORBEON.xforms.Document.setValue((ORBEON.jQuery('*[id $= "local-branch-control"]')[0]), "MYVALUE")
I tried different combinations but none of them worked. Is this even possible in Orbeon?
Thanks
Figured it out, this is what I did:
myInitialValue = ORBEON.jQuery("select[id*='my-select-control'] option:contains(" + myInitialDisplayName + ")")[0].value;
ORBEON.xforms.Document.setValue(ORBEON.jQuery(ORBEON.jQuery('*[id $= "my-select-control"]')[0]).find('.xforms-select1')[0], myInitialValue);

search in textbox for different fields help is required

We have requirement, to search for different fields using a single text box. For example, the search has to be based on three fields; Product, Brand and Place.
Initially the user will be given the below text in the textbox which cannot be modified: Product:-Brand:-Place
When user wants to search for Product, Brand and Place, he will just add values: Product:"TV"-Brand:"Samsung"-Place:"London"
When user wants to search for just Product: Product:"TV"-Brand:-Place
Can some body help me, how can be done that in jQuery or angular js?
This can be done using angular filter..
You can pass an object as the second parameter to achieve this if you can have two search fields
<div ng-repeat="friend in user.friends | filter:{name:searchNameText, age:searchAgeText}">
Otherwise you'll need to write a custom filter to use the same field for both, or pass a custom filter function as the third parameter which is described in the docs.
http://docs.angularjs.org/api/ng.filter:filter

Populate Kendo DropDownList with array from selected value

Using javascript I want to populate a dropdownlist (DDL2) with certain data from a REST JSON endpoint based on the selected value of the DDL2.
This DDL2 selected value is triggered by previous DDL1 selection (I have that part working). For example if DDL1 selected value is "Town" then the selected value for DDL2 is: "SELECT towninfo FROM towns ORDER BY towninfo". It's a SQL query, currently. I have the option of replacing it with a comma-delimited array of towns (RALEIGH,CHARLOTTE,ASHEVILLE...), or I could replace it with a JSON string. I'm open for suggestions on that part.
What I want to do is populate DDL2 with the selected array. So when I select "Towns" in DDL1 then DDL2 populates with a list of towns. Thanks!
If you mean something simple as populating a second drop down based on the first one's selection, here is a quick and dirty sample...
http://jsbin.com/AHOpAJA/1/edit
If you want something a bit more complicated, here is another one using three dropdowns, that all bind from a service. http://jsbin.com/ihodoc/3/edit

Categories