pugjs - radio button checked attribute as variable - mixins

Working on a pugjs mixin. Creating radio buttons in a loop over json. Normal name-value pairs are work as expected. In the loop, setting a radio button to checked by default is fine. Trying to figure out how to not set the checked value for non-selected radio buttons.
I can do this with javascript but seems like I should be able to do this in pug.
Tried setting a variable
-checked =(!fVar.checked)?'checked':''
and then use in tag
input(type='radio' #{checked})
Is there a way to do this in pug?

Figured out one way. Not as direct as I would like but I nested mixins.
The main mixin has a case statement that calls child mixins.
case fVar.checked
when 'true'
+radioChecked()
when 'false'
+radioUnchecked()
Not very D.R.Y. but it works.

Related

how do i set variable in toolbar_sticky_offset option of tiny editor

i'm using vue2 with #vue/composition-api
in some reason i have to use display:none to component that have tinyEditor.
The problem arises when i disabled display:none. tinyEditor not deleted but just disappearing so when i scrolling, event still work in tinyEditor.
so 'tox-tinymce--toolbar-sticky-on' <- keep stick to tinyEditor.
i've tried use computed to option, watched params(the variable value is params) and add variable class none of them work. obviously my approach doesn't effect to tinyEditor.
how do i set some variable value in toolbar_sticky_offset option?

PowerApps Get Selected Item from Lookup to make a Button Visible at the Command line bar

I want a button from the command line bar to be visible or invisible depending on whether a record has been selected in the lookup field from the main form or not.
If no record has been selected, then the button should be displayed. Otherwise not.
For this problem, I want to use the Power Fx in PowerApps, but I haven't found a command yet, which shows me the content or something like that of the lookup field. Other field data types like text have worked without problems.
With Javascript, I already managed it without problems, but I would like to do it also in PowerFx if that should work.
Screenshot: https://i.stack.imgur.com/uqDJ6.png
The records come from the Table Company, where the attribute is Companyname.
Commands where I think they might work:
If([Selected Record];true;false);If(IsBlank([Selected Record]);true;false);If(IsBlankOrError([Selected Record]);true;false);If(IsEmpty([Selected Record]);true;false)
I guess there are 2 scenarios:
The Lookup form control element is a Dropdown with a Selected output property. Then your approach would work like If(IsBlankOrError(DataCardValue1.Selected),true,false)
If your form control element is a ComboBox then you could use If(CountRows(DataCardValue1.SelectedItems)>0,true,false) or the above described IsBlankOrError.

Wrap a list of WebElements and present as a single WebElement

I am automating testing of a response web app and have an issue with multiple elements on the page with the same #FindBy selector where only one is visible at a particular screen resolution (in this case a logout button that 'moves' around the screen).
I could just get a list of webelements and click on the first visible, but I was wondering if I could do something smarter using html elements:
Given the following annotation
#FindBy(css = ".logoutButton")
MultiWebElement logoutButton;
When I call this method
logoutButton.click();
Then the MultiWebElement class will iterate over all elements that match the find by and call the click method on the first one that isDisplayed().
Unfortunately the decorator seems to want logoutButton to be of type List which defeats the purpose of creating the new class.
Can I do something like this, or is this outside the current scope?

GXT 3 spinnerField validation

I want to validate that user cannot change spinner value manually by typing in text box of spinner.
For example a field sales multiple = x which I fetched from server not fix.
and displays a spinner field with limitation of like bellow
spinner.setMinValue = x
spinner.setIncrement = x
spinner.setValue = x
so user forcefully select a value which is multiple with x. e.g. if x=3 the user have to enter 3,6,9... and so on.
So here my issue is if I type a 2 in spinner field text box. GXT widget accept that value.
Posible solutions:
Is there any predefined properties of spinnerfield that i forget to set it?
Is there any predefined validator for this?
Can I set text box of spinner field read only by css so user cannot focus on text box but still change a value.
If none of above how to achieve manually?
i've searched a bit in the different classes and I don't see either a precise method which would set what you want.
Don't know about one, and even with one, a validator doesn't change the value in the input field, but maybe it's enough for your needs.
You can disable the text input by calling setEditable(boolean) on the spinnerfield (testSpinner.setEditable(false);)
Maybe you could search around the IntegerPropertyEditor, I haven't tried but as long as a new Spinner is like this:
SpinnerField<Integer> testSpinner = new SpinnerField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
you can seen that there is another Constructor for IntegerPropertyEditor, which takes a "NumberFormat" param, but there is no NumberFormart() constructor, so I'm not sure about how you create your own one, but that could be an idea (to format numbers in the input to be a multiple of the increment).
The last option would be that Sencha forgot this possibility and that you should report this as a "bug" on the forum ?
Hope to have helped a bit, good luck :).

wicket: Dropdownchoice

i have two dropdowns using same model and sets the value into it. Dropdown1 will visible on screen always and Dropdown2, will be visible for only one particular option choosen in Dropdown1. and i am making an query to the DB based on the selections in dropdowns.
But when i have both the dropdown first and then hide the second one, The value already set but the Dropdown2 is still avalible in my model, and making my query to fetch improper data.
So can any one suggest me an idea, how to set the value to null for the attribute which is actually set but dropdown2, if dropdown2 is inVisible.
(i tried to set the ModelObject to null, when making the dropdown2 invisible (using AjaxFormComponentupdateBehavior), but when i make the dropdown2, visible again, it returns null,even if i make any selection in it)
Are you using a LoadableDetachableModel ? try to explicitly detach model from that dropdown on setHide event. I did not try it though.