htmx: Trigger based on all radio buttons in a form - htmx

I'm trying to trigger ht-get of a form based on the change of any of the radio buttons in the form without the user having to hit the submit button. Therefore, I'm trying to use the hx-trigger attribute on the form with the from:find feature, but I keep getting an htmx:syntax:error in the console and no triggering.
<form action="/cvss/calc" method="get" id="cvss-calc" novalidate hx-get="/cvss/calc/cvss_details_html" hx-trigger="from:find form#cvss-calc .btn-check">
All the radio buttons have the btn-check class defined on them. I've also tried from:find .btn-check but that doesn't work either.
What would be the proper format for doing this?
UPDATE: I figured it out, I was apparently trying to be too fancy. I changed the hx-trigger to be just "change" and it works wonderfully since the form only has radio boxes.
It would still be nice, though, to know how to listen for change signals from only specific sets of inputs.

Related

in Access, Bound Combo Boxes do not update unless the form is already Dirty

I'm working on a fairly complex Access Database, trying to build forms with custom buttons for working with records. I'm using list boxes to display and navigate through records and all fields for existing records are disabled unless the user presses an edit button. The problem I'm having is that if I press the Edit or Add New button, enabling all of the fields, and then try to change the selection in a combo box, it does not update on the first try.
If I edit a text box first then the combo boxes work fine.
I've determined that the control's beforeUpdate and afterUpdate events are not firing on the first try but the action triggers the form_Dirty event and then it works as expected. I tried setting Me.Dirty = True with the Edit button and that solved the problem but it causes problems with some of my other code and it seems like an unnecessary workaround if only I understood the actual cause of the problem. It also works as expected if I leave the Combo Box unbound, but I am trying to build a template that doesn't require too much work to build new forms off of and I would rather not go that route.
It must have something to do with some bit of code I'm using because I can start a basic form and the combo boxes work fine.
I've started a basic test form and am adding code from my template form bit by bit until the problem arises, but it's a tedious process. Any help would be appreciated.
What am I missing? Is there some way of getting the Combo Box events to fire before the form is dirty?
UPDATE:
I have templates for a basic form, a form with a single subform, and a form with multiple subs in a tab control.
After some more testing I discovered that this problem does not apply to the basic form which has no subforms. This template uses similar code to the others for new, edit, cancel, save and delete buttons and for preventing accidental changes, preventing Form_unload during an edit and so on. The main difference I can think of off the top of my head is that the templates with subforms use class modules and collections to hold various data and pass it between the main form and subforms. Not sure if or how this might relate to combo box functionality.
I built most of this last winter then got too busy over the summer to work on it. Just now picking it up again and I'm having to re-learn a lot of the details of how my code works.
you can try to use Me.CboName.Requery in your After Update event.
I figured it out. I was calling a procedure with a form refresh in it from the Form_Dirty event and for whatever reason the refresh at exactly the wrong time was causing the combo box Before_Update and After_Update events to be skipped and the combo box value to not change. It was also causing text entered into a textbox to overwrite existing text on the first keystroke.

Vue native color picker #input when no change is made

Here's a situation: I have a regular non-Vue component color picker with the simple <input type="color"/> which works almost perfect, except in one case. The case being, when there's already a color existing in the picker and all the user does is click "Ok". I would expect that the vue #input or #change event would fire and set the color value even if the user didn't choose a different color. However, when the user simply clicks "Ok" and does not choose a new color, there is no event fired for either #change or #input. What's a way to fire this event in such a case?
That functionality is unfortunately not available.
You can use #focus, with the caveat that it will fire when you click, and when you exit (cancel or OK)
You could add some custom #blur and #focus events to get something similar, but I think using just #focus (triggered on click too) may work in most scenarios

Dynamically Add Option Buttons to Excel UserFrm with One Event Handler

I have a custom user form in Excel where the number of option buttons is dynamic, depending on what a user selects from a combo box. I have written a script that will add and format those option buttons with appropriate captions, groupname, etc. However, I would like it so that after those buttons are added dynamically, if a user clicks a button from a group just added, then more code will be executed. I am aware that one can create a custom class so that multiple userform controls are handled with one event handler, but I can't figure out how to get this to work with controls that were added dynamically to a form, after the form initialized. I am hoping this question makes sense. Thanks in advance for any help you can offer.

Prevent enter firing button click in Vue.js

I am trying to sort out a user interface problem where an enter key pressed in an input field is effectively firing a click event on a button (presumably because it now has the focus). The button in question has a prevent modifier on its click action (i.e., <button #click.prevent="blah">), but that doesn't help. What I want to do is ensure that the button action is only executed by an actual click on the button, not by enter in a preceding input field.
LATER: I have this working now using <a #click.prevent="blah"> instead, with the link styled as a button via Bootstrap. This doesn't have the problem - an Enter key doesn't fire the handler. It seems insane to me that there is no way of distinguishing between a mouse click on a button and the Enter key firing it. Both are seen as a MouseEvent, and I can find no way of differentiating between the two.
Actually, the answer was extraordinarily simple, but not immediately obvious. I was using plain <button>. I had forgotten to add what the type tag, which I normally would, thus: <button type="button"> Once this was in place, the Enter key no longer fired it.
What worked best for me was an empty #click.prevent="" in combination with #mousedown.prevent="myfunction".
This:
prevents the 'Enter' key from triggering a click
keeps the tag from receiving focus on click (except on keyboard navigation)
prevents page reload on any href="#"
My fiddle: https://jsfiddle.net/j8fchbvk/37/
In a similar situation I fixed it by getting rid of the <form> tag . Since Vuex was handling form-submission, I did not need the form tag anyhow.

How can I make a Wicket form save radio button state?

I want to have a repeater like DataView or ListView. The first column of each row (named User ID) should be read from a List, and for each user ID, the program should dynamically create three radio buttons like these:
Requirements:
The user must able to change selection of radio buttons.
When the user clicks the submit button, radio values be displayed using the info("") method.
I've already done this by using this example, but when I click the submit button, old selections are shown, and the form gets reset to those old selections.
This example code might be helpful.
ListView doesn't play very well with form components, but it may work if you call ListView.setReuseItems(true);.