Is it possible to disable one of the options among a group of radio buttons? - readonly

I have a radio button control with two items in it.
<xforms:select1 ref="add-delete" appearance="full">
<xforms:item>
<xforms:label>Add</xforms:label>
<xforms:value>A</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>Delete</xforms:label>
<xforms:value>D</xforms:value>
</xforms:item>
</xforms:select1>
I want to disable only the radio button 'Delete' and not the radio button 'Add' on condition X. How can I carry out this ?
I tried using class attribute with xforms:item but that is not working. Is there any other way to do this ?

Good question. And unfortunately, this isn't as easy to do as it should:
If you just wanted the delete radio button to be hidden, instead of disabled, you can replace the <xforms:item> for the "Delete" by an <xforms:itemset ref="…"> that you bind to a node which you make non-relevant when you want that radio button not to show. But you can't use that same technique to disable the radio button by binding the itemset to a node you make read-only. (And yes, it would be good if you could do that.)
As it stands, I think you'll need to:
Create 2 <xforms:select1>. One for "Add", one for "Delete", so you can make the second one readonly upon some condition.
To make it readonly, but not have the "Add" be read-only as well, you need to bind them to 2 separate node.
If you want to have 1 node with either A or D, you need to create a calculate to populate that node based on the 2 values.
You want the values to be exclusive, and they won't be if you have two <xforms:select1>, so you need to deselect "delete" when "add" is selected reacting to xforms-select, and vice versa.
In the model, you would have:
<xforms:instance>
<instance>
<add/>
<delete/>
<add-delete/>
<delete-enabled>true</delete-enabled>
</instance>
</xforms:instance>
<xforms:bind ref="add-delete" calculate="string-join((../add, ../delete), ' ')"/>
<xforms:bind ref="delete" readonly="../delete-enabled = 'false'"/>
And in the view:
<xforms:select1 ref="instance()/add" appearance="full">
<xforms:item>
<xforms:label>Add</xforms:label>
<xforms:value>A</xforms:value>
</xforms:item>
<xforms:setvalue ev:event="xforms-select" ref="instance()/delete"/>
</xforms:select1>
<xforms:select1 ref="instance()/delete" appearance="full">
<xforms:item>
<xforms:label>Delete</xforms:label>
<xforms:value>D</xforms:value>
</xforms:item>
<xforms:setvalue ev:event="xforms-select" ref="instance()/add"/>
</xforms:select1>
And see this Gist for the full source of this example.

Related

MAUI Show/Hide controls based on mode New/Edit/View

I need an idea, please. I have a Details form which shows the fields of a model (about 10 fields in all). There are three modes in which I could show this view - in mode "Edit", in mode "New" (which, of course, is like an edit but without values), and in mode "View" (no changes allowed, just labels).
I could of course create three Details pages, one for each mode, and call them selectively, but I would like to have just one and pass the "DocumentMode" parameter to it. That View should bind to that mode and selectively show/hide controls, probably like "DocumentMode = VIEW => Show labels" or "DocumentMode = EDIT => Show Entry or Editor, show DatePicker, TimePicker, etc".
My question is this: How do I show/hide these groups of controls depending on the DocumentMode parameter ? Which would be the best way to do this ? I could probably bind the "IsVisible" property to my documentMode parameter, but I think that is a really ugly solution (and I assume that regardless of whether the controls are used or not in a specific mode, they will all be loaded anyway).
Thank you.
Alex
I think you can use a Listview or Collectionview to represent your data because you mentioned that you have 10 fields.
In addition, you said you need a "new" button, so you can set it at the top of the app as a button, when you click the button then you jump to another page which is blank and you can add the data.
This must refer to the shell you may need to set a navigation.
Then the "view" and the "edit" you can use the property SelectionChanged to control the item, I mean when you click the item in collectionview, the SelectionChanged method can be triggered and turn to another page which can show the detail about the item you clicked. In the page you can view and edit the data.
Here are some articles you might be able to use: Listview, Collectionview, Shell
If you have more information to add, please kindly share with me.

Custom drop-down as an item in a kendo tree

I am trying to create an item that is a button "show more" and when you press on it you can show a kind of context menu / drop down that all of the items in that drop down are with checkboxes and there is a search component in it too, so you can search some items in the dropdown by their name. For example: (instead of "c++,c#,Object c" it's should show "show more", i.e. static text)
I tried to use kendoContextMenu. But I don't know if it's could work because the problem with context menu is that when I will click on a checkbox the menu will close. Please advise me of a way to do that or if you have an example of code. Thanks!
The MultiSelect component might be a good starting point
https://docs.telerik.com/kendo-ui/api/javascript/ui/multiselect.
My understanding is that MultiSelect does not have a "select more than one at a time in dropdown" feature.
You might consider using a pop up window and within that implement your own custom ui that features everything you want
search term box
scrolling list of selected and selectable items
accept or cancel changes in selection
Regarding your dojo that extends drop down list, I can't code the extension for you. However, changing the dataSource assignment to a setDataSource call will populate the extension component according to the template.
// kendo.ui.DropDownList.fn.dataSource = options.testItemSource;
me.setDataSource(options.testItemSource);

Multiselect option with remove item

I'm looking for a Qt/QML multiselect control that have a remove button.
I want to add a filter builder and I didn't find a good example or control for this purpose.
I can design token by myself. I'm just curious if someone already did that and can share it.
Multi filter selector
Thanks
A simple radio button for each option can do the job. If you do not include all these radio buttons under an exclusive group, a second click on these buttons deselects the option.
A click on the radio button includes selected option in the search results and second selection removes the option from the results.
An extra button which deselects all the radio buttons can also be added.
I don't intend to insult or disrespect you, but i think with radio buttons the task takes less time than posting this question.

How to use and create Dynamic Panel in Dynamic Form Module in DNN?

I have some controls RadioButton,CheckBoxGroup and TextBoxes.I want to add these controls in this Dynamic Panel . And I have a Combo Box which have values 1,2,3,4,5,6. So when i select 1 from Combobox, 1 panel should display , when i select 2 from Combo box , 2 same panels should display an so on. Please help me anybody.
If you are referring to the Dynamic Forms module by DataSprings, you can create the intended behaviour by using "Question Events". You would first go into each "panel" you want to hide and click the "Hide question until forced visible by question event" checkbox. Then, go to the Question Events page and set up one event for each combobox value, with each one set to display the appropriate "panel". Several demonstrations are available here.

GUI: radio button group without selection?

Image a couple of objects for which one property can have 3 possible values. To edit them I want to use a radio button group with 3 buttons. If you have one object selected, it's obvious which radio button to select. But which what to select if multiple objects with different values of this property are selected? A radio button group without a selected radio button looks somewhat "naked".
One possible solution would be to add a 4th button to the group that indicates that the property is not set. You could have that one be the default when you need an 'indeterminate' default setting. This would allow the radio button group to start out with a selected radio button.
That being said, I'm having a hard time visualizing your situation. Do you think you could add some more detail to your question? I think you are talking about the default state of the radio buttons, but I'm not totally sure.
Hope this helps.

Resources