How to stop increment of Numeric stepper in Flex - flex4

In single click the value of numeric stepper increments continuously till we release the mouse.I need one value increment in each click.How to achieve this in Flex 4 Numeric stepper?

Override the click handler , handle the event manually
Just in case if you want to override the whole click behaviour ..
use event.preventDefault();

Related

How to go back to a specific table data to click the radio button using cypress [duplicate]

I'm very new to Javascript and it's my only second week using Cypress, so I need help in getting radio buttons to be clicked. I'm getting errors from Cypress all the time.
The element that I'm trying to check looks like:
<input class="XyzTypeRadio" type="radio" name="zzz_type" value="2">
And what I tried to implement after reading the Cypress documentation (at https://docs.cypress.io/api/commands/check.html#Syntax )was:
cy.get('[type="radio"]').first('.XyzTypeRadio').check('value=2')
Also tried simply .... .check('2') and ... .check('Xyz')
(edited and working answer)
Try this:
cy.get('[type="radio"].XyzTypeRadio').check("2")
Or if you don't care which radio button is checked, you could check the first one:
cy.get('[type="radio"].XyzTypeRadio').first().check()
Takeaways:
The first() function does not understand selectors, that's why we need to pass our selector ".XyzTypeRadio" to get().
The check() function expects the value or values as its argument, so instead of "value=2" we simply give it "2".
The check() function does a bit of selecting, ie the result of everything before calling check("2") is a list of inputs and the check("2") function searches and selects the one whose value is "2".
We could use first().check() if we want to check the first radio button, or we could remove first() and check a radio button with a specific value using check("2").
cy.get('[value="Other"]').first().check()
this worked for me as there are 3 radio buttons each with a value so it was just a matter of selecting the correct value

How to avoid events to popup to accordion

I have an Accordion Panel whose summary is a search field:
When the content of the search field change, the panel shall be opened and show search result.
It happens that the events in the search field pop-up to the the tab that consequently opens and closes the tab when space or enter keys are pressed. I tried to wrap the summary in a special div that prevents pop-up:
class MyDiv extends Div {
public MyDiv(Component... components) {
super(components);
getElement().executeJs("addEventListener('keydown', (e) => {console.log('pop up prevented'); e.stopPropagation();});");
}
}
...
accordion.add(searchAccordionPanel = new AccordionPanel(new MyDiv(searchField),
searchItemsPage = new MenuItemsPage(this)));
And in fact I see the events intercepted ("pop up prevented" on console) but for some reason the accordion still responds to keypress. I have also tried keyup and keypress events, same result.
Maybe Vaadin transmit another event? Can anybody suggest a solution?
By default TextField is in eager value change mode, i.e. it emits value change after each key stroke. This does not fit in your use case. You can use textField.setValueChangeMode(ValueChangeMode.LAZY) for example. Then TextField will emits value change after user has paused typing. There are also couple of other modes, pick the one that fits the use case the best. Some times it requires trial and error.

create toggle button in toolbar

I am using MS CRM and USD where I am suppose to create a toggle button using WPF hosted control. I followed the tutorial over here.However I want to change the text of button after it is clicked.
To do literally what you describe may require more effort and complexity than a resonable alternative, so I want to explore both of those possiblities here.
The Desired Answer: Replicating Toggle Button Behavior on Non-Toggle USD Buttons
Set the Button's label to a $Context parameter, like [[$Context.ToggleButtonText]]. Be sure to push this value at DesktopReady using your Global Manager's CopyToContext action. We'll use this label to define the state of the button, so let's say that we'll only push values "On" and "Off" to this parameter.
Similarly, set a $Context parameter to indicate whether the button is changing, like [[$Context.ToggleButtonIsChanging]]. Upon DesktopReady, set this to false. The same Action Call can push both ToggleButtonText and ToggleButtonIsChanging to $Context simultaneously.
Define three Action Calls for the button click.
3a. The first Action Call will set ToggleButtonIsChanging to true.
3b. The next two Action Calls should be given names like "Toggle Button to Off" and "Toggle Button to On". Both Action Calls should do nothing but perform a condition check, thereby authorizing or preventing their Sub-Actions from firing. (More on defining these Sub-Actions to come.) I recommend using the Global Manager's Pause action to perform a 1ms Pause when the condition is true.
3c. For Toggle Button to Off, the Condition should be "[[$Context.ToggleButtonText]]"=="On"&&[[$Context.ToggleButtonIsChanging]]. For Toggle Button to On, the Condition should be "[[$Context.ToggleButtonText]]"=="Off"&&[[$Context.ToggleButtonIsChanging]].
Define Sub-Actions for "Toggle Button to Off" and "Toggle Button to On."
4a. The first Action Call (and if necessary, any of its Sub-Actions) should perform the desired automation(s) that would correspond to the Button's state change. In other words, what the button actually does goes here.
4b. The second Action Call should finalize the button's state change by pushing new $Context parameters. Under "Toggle Button to Off," you want this action to set ToggleButtonText to Off and ToggleButtonIsChanging to false. Under "Toggle Button to On," you want this action to set ToggleButtonText to On and ToggleButtonIsChanging to false.
A Simpler Suggestion: Separate Buttons with Visibility Conditions
Define two buttons, "On" and "Off."
Upon DesktopReady, push a value "On" or "Off" to [[$Context.ButtonState]].
Define Visibility Conditions for both buttons. For example, the On button should only be visible if "[[$Context.ButtonState]]"=="On"
Define Automations for both buttons. You'll need at least two Action Calls.
4a. For each button, your first Action Call(s) should define the desired automation(s).
4b. The very last Action Call under each button should push the converse value to $Context. For example, the On button's final action should CopyToContext ButtonState=Off.

Get value from autocomplete text field in ApEx

I want to create a dynamic action, that will set a value to an item on the page, when the value of another item (autocomplete text field) is set.
So the proccess goes like this:
Click on the autocomplete field
type some letters
choose one of the suggested values
I cannot find an event that will be executed when the selection of one of the suggested values happens. This way, I cannot see how I can read the value of the autocomplete field, once a suggested value is selected.
The change event doesn't fit my needs, it doesn't execute when one suggested value is selected.
I had the same problem, found this link: https://community.oracle.com/thread/2130716?tstart=0 and modified my dynamic action as follows to get the desired behaviour:
Event = Custom
Custom Event = result
From the link:
the problem seems to be the default behavior of the browser. When you
enter some text into the autocomplete and the list is displayed, the
focus is still in the text field. Also if you use the keyboard cursors
to pick an entry the focus will still be in the textfield. That's why
the change event of the textfield doesn't fire. It only fires if you
leave the field.
On the other side if you pick an entry with the mouse, the browser
will remove the focus from the text field for a moment (before the
JavaScript code puts the focus back), because you clicked outside of
the field. But that's enough so that the browser fires the change
event.
I had a look into documentation of the underlaying jQuery Autocomplete
widget
(http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/) and
there is actually an event called "result" which can be captures if an
entry is selected from the drop down list.
Try "Lose Focus" as event. It will trigger your dynamic action when you leave the autocomplete field, i.e. your curosr is moved to another field.
This probably depends on the APEX version you are using.
In case of 18.2, because the underlying component is based on Oracle JET's "inputSearch" component, you need to use following configure to capture the select change event for text with autocomplete:
event: Custom
custom event: ojupdate
Reference:
https://docs.oracle.com/cd/E87657_01/jet/reference-jet/oj.ojInputSearch.html#event:optionChange
I turned on the browser console, then turned ApEx Developer toolbar debug, and found that, on the contrary, the "Change" event does fire upon user clicking with the mouse on one of the selections. However if the user uses keyboard (type a few letters to narrow the list down, then use down arrow key to arrive at desired value, then press enter) then the Change event does not fire, just as you say.
Moreover: even when you do get the value sent back via mouse-click initiated Change event, the value isn't the autocomplete's complete and valid value, but instead the possibly partial and wrong-case value just as typed by the user. I.e., the the change event's submission of the value precedes the autocomplete's substitution.
The answer that #VincentDeelen gave is the best alternative that I can see, although it doesn't quite give that "instantantenous synchronicity" feel. You could maybe use the "Key Down" event, but be careful with that. You could get a really excessive amount of web and db traffic as each and every keystroke (including corrections) results in another firing of the dynamic action.
Testing environment: ApEx 4.2.3 with Chrome 33 as well as IE 9.
p.s. This might be worth a mention to the ApEx development team as well.
It's not really ideal, but you could use onfocus(). I'm looking for the same thing you are, I think, a custom event that fires when the selection of a suggested value happens. I haven't found it yet though and that is my work-around for now. It will run whatever function you've created for this initially with no value, but once the selection is made it will return focus and run the function again with the right value. Like I said, not ideal but it works.
Jeffrey Kemp is right. You can set it up through a dynamic action using the custom event, result. You can also register it on page load using document.getElementById("{id}").addEventListener("result", {function}); or $("#{id}").result( function( event, data, formatted ) { //something here });.
Oracle apex 19 now added a "component event" when you create a dynamic action called "Update [Text Field with autocomplete]" - this action is fired when you select a value from the list, but not when you leave the field (similar to adding the custom event "ojupdate").

Event for selecting an option even though value is not changed in dijit.form.Select.

I need help in figuring out the event that is fired when I select a dropdown value from dijit.form.Select. I already know of the onChange event and would like to know an event which fired even when the value is not changed.
Use Case
I am using dijit.form.Select in my project. I have some values like {Multiple,a,b,c,d} in this select drop down. When I select Multiple then it launches the pop up dialog. When I select other values a,b,c or d then that value gets set in that drop down.
Currently I catch onChange event to check if user has selected "Multiple" value so that I can launch the pop up dialog.
Now here is one issue. 1. Lets assume that by default selected value is a. 2. Now I select Multiple, onChange gets fired and pop up dialog gets launched. 3. Now again if I select Multiple then onChange event won't be fired and thus code would not launch pop up dialog.
I want to launch this dialog every time user selects "Multiple" value in the dropdown. Any suggestions to do this? I have tried useing onClick, onBlur and onFocus events but they are not of much use to me.
Please help.
You can Capture the 'onExecute' event of the dropDown of the dijit.form.Select widget for this behaviour. However, keep in mind that you wont get the newVal as an argument to the function for this event. to get the new value, use the following line as the first line of your function:
var newVal = this.focusedChild.option.value;
This will work for sure :)

Resources