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

feat: add Radio Field #479

Merged
merged 3 commits into from
Apr 29, 2020
Merged

Conversation

vikotar
Copy link
Contributor

@vikotar vikotar commented Apr 28, 2020

Closes #464
This PR is the implementation of the radio text field in the redwood framework.

The default required attribute is false for the radio field. If the user wants to have required true for a group of radio fields, the user has to pass the prop validation={{ required: true }} for all the radio fields/buttons.

To check how react-hook-form handles the creation of the radio fields, It can be checked here. They also do { required: true } for all the radio fields in a group. :)

@vikotar vikotar marked this pull request as ready for review April 28, 2020 22:23
@cannikin
Copy link
Member

Thanks so much for this @vikash-eatgeek! So you've tested this locally and forms work as expected? If you leave required as false and submit a form, does it still submit the key but with an empty string as the value? Or null? Or does the object not contain the key at all?

@vikotar
Copy link
Contributor Author

vikotar commented Apr 29, 2020

When required is false, and the user submits the form without selecting any radio field, the submission happens with an empty string '' associated with the radio name attribute.

I have tested it locally; it works as expected. Consistent with other field's behavior. 😎

@cannikin cannikin merged commit e0cfdf7 into redwoodjs:master Apr 29, 2020
@cannikin
Copy link
Member

Thanks so much! Let me know if you want to do the checkbox input next. ;)

@vikotar vikotar deleted the feature/form_radio_button branch April 29, 2020 22:01
@vikotar
Copy link
Contributor Author

vikotar commented Apr 29, 2020

@cannikin thanks for reviewing and merging the changes.
I was thinking about that. Afterall I am becoming pro in form fields. I would be more than happy to do the tick the checkboxes. thanks!!

FYI: Great videos on redwoodJS. My friends and I are learning redwoodjs from your tutorials. We have an everyday calendar meeting called Climbing Redwood for learning together. :)

@cannikin
Copy link
Member

cannikin commented Apr 29, 2020 via email

@vikotar
Copy link
Contributor Author

vikotar commented Apr 29, 2020

The videos are great. I have watched the page loading indicator video on twitter. till now, everything is great. I will surely give feedback if something comes up.

@thedavidprice
Copy link
Contributor

Hi gents! Must say the code is great. But the included update to docs just makes me 😍

@thedavidprice thedavidprice added this to the next release milestone Apr 29, 2020
@vikotar
Copy link
Contributor Author

vikotar commented Apr 30, 2020

Thanks, @thedavidprice. I just followed the code/readme structure in the codebase. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add <Radio> field
3 participants