-
Notifications
You must be signed in to change notification settings - Fork 99
(fix) O3-4613 Choosing a default radio button "type of date picker to show" radio group #446
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
base: main
Are you sure you want to change the base?
Conversation
Thanks @yoursanonymous, great catch! Really appreciate you pointing this out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think its really necessary to default pick a datepicker type for this, but if we are doing it, its much better to set it here when the rendering type is being set rather than use an useEffect-
Line 105 in b5221ee
const updatedObject: FormField = |
We should avoid the usage of useEffects wherever we can - https://react.dev/learn/you-might-not-need-an-effect
Hi @NethmiRodrigo, Thank you for reviewing my PR, Could you please review it again. |
@@ -25,7 +25,7 @@ const Date: React.FC = () => { | |||
); | |||
|
|||
return ( | |||
<RadioButtonGroup name="datePickerType" legendText={t('datePickerType', 'The type of date picker to show ')}> | |||
<RadioButtonGroup name="datePickerType" defaultSelected="both" legendText={t('datePickerType', 'The type of date picker to show ')}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using 'defaultSelected' property of RadioButtonGroup would be a better way to set the default value for Date picker type, made the required changes as well.
Using the defaultSelected
that would mean that the user gets the impression that when they save the defaultSelected value would be persisted, but that isn't the case here. To fix that, referring back to my first suggestion, you'd have to set the datePickerFormat
in the formField
while using the defaultSelected
here
…roup button
Requirements
Summary
When we create a question of type "encounterDateTime", we have radio buttons of "type of date picker to show" should be selected when we save a form but, it's not working.
Screenshots
Before
beforeSave.mp4
After
afterSave.mp4
Related Issue
https://openmrs.atlassian.net/browse/O3-4613
Other