Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radio element can not be checked #2526

Closed
weichenghsu opened this issue Jan 29, 2017 · 4 comments
Closed

Radio element can not be checked #2526

weichenghsu opened this issue Jan 29, 2017 · 4 comments

Comments

@weichenghsu
Copy link

weichenghsu commented Jan 29, 2017

The sample from the official example can work

    <label>Favorite Color</label>
    <div>
    <Field name="favoriteColor" component="select">
        <option></option>
        <option value="ff0000">Red</option>
        <option value="00ff00">Green</option>
    </Field>
    </div>

The following example won't work.

The radio option can not be checked at all,
When I clicked any of the radio item, the checked status will be restore in a flash. That is, I could not select any item.

inline

ui_builder_form.tsx

    schemaData.tableList = [
        {
            name: "AcceptedEventRelation",
            value: "ff0000"
        },
        {
            name: "Account",
            value: "00ff00"
        }
    ]



    <MyCheckBox
        items = {schemaData.tableList}
    />

   
    UIBuilderForm = reduxForm({
        form: 'dashbaordUiBuilderForm'
    })
    (UIBuilderForm as any);

my_check_box.tsx

    export class MyCheckBox extends React.Component<any, any> {
        render() {
            let {items} = this.props;
            return (<div>
                    <h1>table name</h1>
                    {items.map((item:any, i:number)=> {
                        return (
                            <label key={item.value}>
                                <Field
                                    key={item.value} name={item.name} component="input" type="radio"
                                    value={item.value}/> {item.name}
                            </label>
                        )
                    })}

                </div>
            );
        }
    }                    
@ruanyl
Copy link
Contributor

ruanyl commented Jan 31, 2017

can you paste ui_builder_form.tsx in more detail?

@pcgilday
Copy link

pcgilday commented Feb 8, 2017

Have you provided the redux-form reducer to redux like shown in the docs here?

Also, it is worth noting that all radio inputs in the same group need to have the same name attribute. Once you fix your current issue, you will see that you can select each option at the same time, which I am assuming is not your intention.

@danielrob
Copy link
Collaborator

Closing due to non-response from OP.

@lock
Copy link

lock bot commented Jul 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants