Drupal Form States - How to notify a change in select? - drupal-7

I'm using a select that works with Drupal states. When a user selects certain a value it shows more information. It works fine with direct user interaction.
My problem is that when I make a change in the selector value programmatically nothing happens. I tried firing a change event in the selector, used prop, attr, click... nothing works.
How can I notify Drupal that I'm changing my select control so Drupal fires the appropiate state?
Thanks everyone.

You can find which event drupal listen to for every input type in this function ajax_pre_render_element($element)
for form selects it is the change event, firing it is dependent on your jquery version
try
$('#id').val("1");
or
$('#id').prop('selected', true);
or
$('#id').change();

Related

Disable form filter using expression MS Access

So on one form I have a button than opens a filtered form based on a combobox on the previous form. Works fine. But on the opened form I also have combobox for selecting records - which doesn't work when the form is filtered. I would want to disable the filter when user selects record in that combobox.
Is there a way to disable the form filter using expression in onChange event?
For example:
=[FilterOn]=False
or
=[Filter]=""
These don't work for me though.
Thanks
Cannot be an expression like that in event property. Could build a VBA custom public function with code to neutralize filter and call function in event property. It would be complicated because have to pass form name or form object as argument of function =ClearFilter("formnamehere"). I have not developed function code and really don't think this is best approach.
In most cases, when OnChange event is used, really should be AfterUpdate.

ReactJS MUI Select Component: Get pre-select value

Is there a native MUI event for when the pre-selection value changes in a MUI:Select component?
For example, here is my MUI:Select component with 3 options:
I would like an event for when 'Public', 'Restricted' or 'Private' is pre-selected (but not actually selected; i.e. before the onChange() event), either with a mouse-over event or a keyboard up/down event. This is because I have a tooltip card that needs to change dynamically for the user as they interact with the options.
Using this example https://codesandbox.io/s/3iv96 as a guide, I implemented a bespoke solution by capturing the mouse-over event and extracting the text value. I just realized I have forgotten to handle key up/down.
So the question becomes whether I have just missed the obvious, or do I need to roll my own component by wrapping MUI:Select and publishing the events I need.
Looks like out of the box this isn't supported.
Looking at this thread https://github.com/JedWatson/react-select/issues/745 it has to be done manually.

angularui bootstrap typeahead- prepopulate dropdown list onfocus

I am using angularui bootstrap typeahead module for my project.
I am unable to pre-populate the drop-down with predefined value.
Whenever user click on input text of typeahead, it should automatically show the typeahead suggestion dropdown(from a static JSON).
Whenever user starts typing, then the behaviour should be normal.
I tried this solution but unfortunately it stopped working when I upgraded my angularjs to version 1.3
So I essentially accomplished this by making a custom directive and making a minor modification to the ui bootstrap typeahead code. You have to trick the typeahead into thinking someone has typed something in it. I placed a little pulldown arrow to the right of the field so essentially it looked like a pulldown and clicking on that arrow would show ALL choices. You should be able to do it using onfocus.
Basically find the code in the bootstrap typeahead that binds to the key events and I changed it to check for a keydown event of 40
if(scope.matches.length === 0 && evt.which === 40) { // Added
// COMMENT OUT modelCtrl.$setViewValue(modelCtrl.$viewValue);
modelCtrl.$setViewValue(''); // Added
}
You'll also need to make sure the typeaheadMinLength is set to 0. Note in the code above it checks for the case of the user NOT having typed anything AND the special keydown event that I trigger. You should be able to change this to trigger on onfocus. I copied the bootstrap typeahead to mytypeahead.js and then modified it as above, along with a few other minor mods that you may or may not need depending on if the field is "required" or not.

Form elements are not receiving input

I have a form designed with the GUI designer with input textfields and buttons. I have attached actions to the buttons. When I call up the form with showForm(Form,null), the textfields are not accepting input and the buttons are not triggering the action. This is happening only for this form. Initially, there was the problem solved here Unable to call a specific form from a button in codenameone and then the problem solved here Simulator keeps defaulting to old Main form. What could be the issue now?
As far as I know there may be some issues as you say, but first need to see code
In the form after you added the text fields did you select the text field component and press action event?
Assuming you did that you should get a callback method in the Statemachine class.
This call will be invoked only when the user changes the content of the text field. You can run in the debugger and set breakpoints/step into code to see what is going on.

ExtJS 3 Checkbox Click Listener

Right now I have change listener but it requires the checkbox to lose focus to register. I looked around online and was unable to find out if such listener (or better substitute) exists.
Is there anyway at all to create a click listener?
Have you tried check?
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.Checkbox-event-check

Resources