Event not fired when removing value from autocomplete dropdown - primefaces

I'm upgrading Primefaces from 10 to 11. When deleting a value from a dropdown the change event is not fired. So the previous dropdown value is still selected. I have found that setting forceSelection = "false" in autocomplete the change event fires correctly when removing a value from the dropdown. Setting forceSelection = "true" it does not fire at all when removing a value from the dropdown. The change event should fire when the component loses focus, like when you click somewhere else on the page. When writing something the the dropdown like "test" and removing the value letter by letter with backspace, the event is fiering correctly for all but the last letter. If selecting the whole value and deleting the event is not fired.

Related

dblclick SelectionInput card script services

Double clicking a selection input checkbox only triggers the "setOnChangeAction('functionName')" once but it will update the card UI checkbox appropriately; If the box is checked and then it is double clicked the box will visually appear checked but will only trigger the action function once so the back end doesn't match the cards state. Is there a trick to fix this? Thanks.

Set state togglebutton with databinding

I've got a form that contains a toggle button. To set the state of the togglebutton I use the property 'ToggleState' (which can be true or false).
I want to set the toggle button via databinding. I've pulled some data from a database and placed this in a listbox.
When selecting a item from the listbox all the other fields are populated with the corresponding data.
The only thing that's not set correctly is the toggle button.
Here is the code I have used to set the buttonstate via databinding. The buttonstate does not work.
ToggleButton1.DataBindings.Add("ToggleState", table, "Goedgekeurd", True, DataSourceUpdateMode.OnPropertyChanged)
If I use the code below the buttonstate will set correctly.
ToggleButton1.ToggleState = 1
Can someone help me out what the difference is between the two?

actionscript 3 automating DropDownList

I want to automate DropDownList when DropDownList id and item index are provided.
I can get DropDownList object on that object I can set selectedIndex as
dropDownObject.selectedIndex=index;
this can change DropDownList selected item to specified index item but when I dispatch "change" event on IndexChangeEvent object it is giving typeCoersion error.
can not convert spark.events::IndexChangeEvent#138445 to spark.events.IndexChangeEvent
Based on your question, I am assuming you want to catch the change in the selection of the drop down list.
Do not dispatch the change event, instead, you should listen for the valueCommit event and not the change event in this case. The valueCommit event is designed to fire when the selected index is changed both programmatically or by user interaction.
Taken right from the docs:
valueCommit
Dispatched when values are changed programmatically or by user
interaction.
So, do something like this:
<s:DropDownList valueCommit="changeHandler(event)" dataProvider="{yourData}" id="dropDown"/>
Hope this helps.
I solved this problem by setting
dropDownListObject.selectedIndex = providedIndex
after calling
dropDownListObject.closeDropDown(true)
so far I did this and solved problem
dropDownListObject.openDropDown();
dropDownListObject.selectedIndex = providedIndex;
dropDownListObject.closeDropDown(true);
dropDownListObject.selectedIndex = providedIndex;
I was missing last line, which was resulting to set selectedIndex to default one.

AS3 (ActionScript 3), Tabbing 3 Times before Switching Fields

It always comes as a surprise to me when I google a problem I am having and I am completely unable to find anything similar. In fact, the only 1 post that i found that describes the same problem can be found here: Tabbing between fields - where does the cursor disappear to?
That question got no responses unfortunately, and I am having the same exact issue.
The only major difference is, I'm using Classic Text instead of TLF Text.
My Form is setup on as3 w/ 2 input fields. the first has tabIndex set to 0, and the second has it set to 1. When i hit tab, the cursor vanishes. If i press it 2 more times, it finally shows up.
I placed the code below to observe what was happening:
var iox = function() {
trace(_root.stage.focus);
if (_root.stage.focus != null) {
trace(_root.stage.focus.parent.name)
}
setTimeout(iox, 400);
}
iox();
I expected to see maybe other fields file that might've been hidden getting the focus or some other object.. But turns out that the only 2 objects that get the focus are indeed my input boxes. After typing into 1 field, pressing tab only once switches the focus to the other field. However, the blinking cursor indicator, as well as the ability to type text into the field only shows up after the third time the button is pressed.
Any ideas?
After some more digging and some trial and error I've managed to fix the problem.
Basically all i had to do was import the FocusManager class and activate it. The triple tabbing button just vanished after that.
import fl.managers.FocusManager;
var fm = new FocusManager(myclip);
myclip.txt1.tabIndex = 0;
myclip.txt2.tabIndex = 1;
Check if any of your other items on display list have tabEnabled property set to true. TabEnabled property description MCs with buttonMode set to true have this enabled. Apparently there are two objects with this setting in the list when you check. So either perform a manual check, or do the complete displaylist walk querying at least class name and name property of any object that has tabEnabled as true.

How to make 1st item of html drop down box (select element) selectable

I have a standard html drop down box.
I want to run js code after the user selected an item without a separate submit button.
Onchange event does not fire when the user selects the 1st item (actually the previously selected item) in the select box.
How can I make the combo box react to the click even if the previously selected item is clicked?
Notes:
1. I don't want to add 'select from here' or something similar to the select box.
2. the onclick event does not help since it fires also on the 1st click the user does to open the options before actually selecting one.
I don't think this can't be done. onchange, as you correctly point out, doesn't work. onmouseup fires too early.
I think onblur would do the trick but it will also fire when the user tabs through the available elements.
If you really need this to work reliably, consider using a JavaScript based replacement widget like this one. They enable you to work around the notorious lack of flexibility that standard form elements unfortunately have.
Oh and by the way, the <select> element is not a combo box, it's a drop-down.
:)
You can use the onclick event but at the same time count the number of clicks.
<script type="text/javascript">
var count = 0;
function selectClicked(sel){
count++;
if (count == 2){
//the user has selected something
//so go ahead and handle it
count = 0;
}
}
</script>
What if you added the "onclick" event to the individual "option" elements rather than the "select" element?