You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When clearing a phone number field, the component doesn't set the default value of "+91" as expected. Currently, only the country flag resets but the input field remains empty.
Steps to Reproduce
Go to Search Patients tab.
Enter a phone number
Click on Clear search for clear the phone number field completely
Observe that the field remains empty instead of showing "+91"
Expected Behavior
When field is cleared, it should reset to "+91"
Indian flag (🇮🇳) should be selected (this part works correctly)
The text was updated successfully, but these errors were encountered:
I want to work on this.
Please assign this issue to me.
Fix Implementation
// filepath: /src/components/Form/FormFields/PhoneNumberFormField.tsxuseEffect(()=>{// Case 1: Field is empty or just has "+"if(!field.value||field.value==="+"){// Reset to India as defaultsetCountry({flag: "🇮🇳",name: "India",code: "91",});// Set default value "+91" when field is clearedsetValue("+91");return;}// Case 2: Toll-free number handlingif(field.value.startsWith("1800")){setCountry({flag: "📞",name: "Support",code: "1800"});return;}// Case 3: Handle other country codesconstcountryCode=getCountryCode(field.value);if(countryCode&&phoneCodes[countryCode]){setCountry(phoneCodes[countryCode]);}},[field.value,setValue]);// Added setValue to deps array
"+91" is getting back , but the country code is not getting back to default ("IN") .
I can work on this , please assign this to me team @Jacobjeevan@rithviknishad
Description
When clearing a phone number field, the component doesn't set the default value of "+91" as expected. Currently, only the country flag resets but the input field remains empty.
Steps to Reproduce
Search Patients
tab.Clear search
for clear the phone number field completelyExpected Behavior
The text was updated successfully, but these errors were encountered: