setState with radio buttons - reactjs

Hi every one hope you're doing good,
I'd like to update my state with radio buttons that I generate dynamicaly.
my state is an array of objects, each object contains one question and 2 or more answer options,
each answer option is a radio button and by clicking it it will update one of the properties of the object.
I'm putting a link to get to the code, you'll be able to make changes and test them (but would not be saved)
I'll really appreciate you're help, thanks
https://scrimba.com/scrim/co9a8447a82665e7746ff8dcc

Related

selected item of dropDownSelectTree disappeared when create button in TabbedForm(React admin) change

I am working with react admin and I am using TabbedForm to add data, the problem is that when I select item from dropDownSelectTree, and then add text to TextInput, the create button change from disable to able and my selected itemed disappeared, I want to know how to keep my selected items when the button change.
This could be a lot of things from incorrect state handling to incorrect props setup. However, without the actual code to check not many people will be able to help you out. So if you may, share your code with us.

Angular Ng repeat with checkboxes - uncheck a particular checkbox from a button click

I have a list of checkboxes - that populate a tag textarea - when the user remove a tag I also want to uncheck the checkbox
When the user navigates away and come back the checkboxes should maintain the state they were in - ie check against the tags and see if they match
So I need
Click state to pouplate tags
initial check to see if the checkbox should be checked or not - the scope of the checkboxes is killed by navigating away unless I rootScope it maybe?
Delete tag unchecks the check box
Only 5 checkboxes in a list can be checked the 6th would return no.
Needs to be a select all with above taken into account
I am really quite lost in how to architect this at the moment
going from click to change to model to checked....
many thanks for any help
try to do the next thing - create an object { clicked : true, label: label}
when you goes throught ng-repeat you have an object to render and state, when somebody delete label - you should just add whole object to handler and there change checkbox state tie to needed element.
P.S. If you add some code we can work with your stuff.

Collection-repeat and checked input type checkbox

I have a collection of contacts and I generate an ion-item for each contact using collection-repeat. Each ion-item has a span, a paragraph and a checkbox element within it. I chose to use collection-repeat over ng-repeat because it increases performance.
I understand that collection-repeat only renders the items that can fit the screen at once and renders more as we scroll.
The problem I have is that when I click a checkbox within an item, for example, the first one, and scroll down to see more lists, another checkbox within an item lower in the list would also be checked automatically. This is not the intended behaviour as I want users to be able to check a checkbox for every item.
These pictures will make the explanation clearer:
Why is my list showing this behaviour? Does it have to do with how collection-repeat works or is it a problem with my code? This is really killing me and I need to find answers. Thanks!
Ionic team is working on it right now https://github.com/driftyco/ionic/issues/1806

AngularJS scope issue with a UI-modal window

I'm using the UI-bootstrap modal window in my Angular application and I'm running into some kind of a scope problem.
I've got a modal dialog which basically has two modes. At first, it displays a list of existing items for the user to select from. In case the item the user needs is not in the list, he can click "Create", then I hide the div containing the list and display another div which contains an input form so the user can add an entry to the list. This is all really trivial stuff. The buttons to toggle which div is being shown work fine. I basically have a boolean scope variable called "create", which takes care of this.
Then, in the modal-footer I have two save buttons. One is shown when in "list" mode and the other is shown when the user is in "create" mode. Again, works fine.
Now, when the user is in "create" mode and clicks the corresponding "save" button, then I need to process the form and finally switch the state back to the list, that is set the "create" scope variable back to false, but this is not working for me. It's like I'm dealing with more than one scope since the view does not update when I update the "create" variable from the button click in the controller.
I've created a working Plunker which demonstrates this, please have a look:
http://plnkr.co/edit/KDxzH21Lmthg0bc0cfUT?p=preview
I know this is probably something really simple I'm missing. Hoping someone can point me in the right direction!
EDIT: As per the suggestion below from Mik378, I created an "intermediate" object in the scope and assigned the "create" variable to it. Now this works like I wanted to.
I updated the Plunker: http://plnkr.co/edit/KDxzH21Lmthg0bc0cfUT?p=preview
If you're using scope.myVariableToReach, you have to change that by scope.oneIntermediateObjectNotAccessibleInTheChildScope.myVariableToReach.
Otherwise, when you set scope.myVariableToReach directly, it would change the child one, not affecting the outer.

Cannot tab out of databound Winforms dropdown list

This is a bit of a strange one, but I've been struggling for a few hours now and I can't understand what is happening.
I was wondering if anyone else has experienced this problem, and can perhaps explain it. I'm building a simple Winforms app and trying to use many of the built in controls.
Basically, I've got a form with a user control and some data capture fields. 3 of the fields are dropdown lists and on the user control I have a bindingSource control that binds directly to a Product class.
At run time I provide an instance of the Product class to the BindingSource and the class contains a property of ProductType. For simplicity I also added a List<ProductType> ProductTypes to the Product Class which loads itself when queried, which means I can just use the same bindingSource and choose the ProductTypes Data Member as the Datasource for the dropdownlist.
Upon running the form, the list binds perfectly and I can see all the product types listed, and I can select one and tab or click to the next field. But obviously the selected value won't bind because I've not chosen any bindings-SelectedValue for the dropdown, only a datasource. As soon as I make sure that the drop down modifies the instance of the Product by binding to the Bindings-SelectedValue, and then run the form, the list still gets populated perfectly and I can tab through the controls as long as I don't make a selection from the dropdown. If I make a selection from the dropdown then the dropdown holds focus. I cannot tab out for love or money and can't even click cancel button on the form, the close button top right is the only button I can click which works and I can't click any other field or dropdown. This affects all three dropdowns as soon as a selection is made.
Anyone have any ideas what I'm missing?
I have tried changing a few things and had some success by feeding the dropdown values a string[] instead of a member of an object. That seems to work, but defeats the object of using databinding doesn't it?
Any help appreciated!
Just guessing here, because I don't have time to set up a test and confirm right now, but are you doing any validating? I seem to remember that data-bound controls won't let you leave if the contents don't validate. Even if you aren't explicitly, try setting CausesValidation to False to see if there's any sort of validation going on behind the scenes, that might at least give you a hint.
Thanks for the input on this, helped me wrap my head around this.
In my case, it turns out that an exception was being thrown in one of the EventHadlers for my ComboBox.Validating event. It was hard to track down, because the IDE didn't show me that exception. I was able to modify the Exception behavior (in the debug menu) and have it show me any InvalidOperationException that was being thrown, and then I was able to track it down.
As Tom suggested, turning off CuasesValidation was the ticket to figuring it out.
For Infragisticst Dropdowns (may not be true for other winform dropdowns): If you have "LimitToList" set to true you can be stuck in a dropdown that you can't get out of without realizing it. Use the ItemNotInList even to trigger a warning message.

Resources