roopeshsn/freshcomm

Form is not properly validated

Closed this issue · 3 comments

Hi @roopeshsn Team, I have just found out about this bug, that the Form is not validated properly.
The example I'm living in Canada and we have a Postal code a mix of AlphaNumeric characters.
So, If I enter the Postal Code say "R2M 0T8" and then I proceed to Place Order, it shows an error

Order validation failed: shippingAddress.pinCode: Cast to Number failed for value "R2M 0T7" (type string) at path "shippingAddress.pinCode"

you are actually using the Type of Postal Code in OrderModel as Number
and in Shipping Component you are using the same field as Text only. So this is not a proper validation.

If you will be using this for a country like India, where all Postal Codes are likely to be in NUMBER, then also we need to add the validation for NUMBER in Shipping FORM.

OR

If also for countries like Canada, then we need to add the Validations for TEXT as both in FORM as well as in Order Model

Solving this issue will enhance the User Experience

If you found this as a bug, pls let me assign this issue as Hactoberfest

Order Validation Falied

Shipping

Hi, @anujverma-eng Thanks for this detailed bug report. As it was not a real-time working application we can accept orders from all countries. Yeah, I will assign this issue to you. Also, the UX can be improved by a drop-down option for Country, State, and City. The desired flow should be like this Address -> pin code or zip code -> country -> state -> city. Would like to know your thoughts on this.

Adding Feature

Yes definately, we can create a dependent dropdown (depends on Country Selected, State selected, and then city ), we can make our own JSON for this, like in which country>state>city , we are serving (the Products) and we can show this in our dropdowns,

but for Postal code, we need to make our Order Model as Text (not number).

@roopeshsn, Pls Let me know the Guidelines while making Pulll Request.

Hi, @anujverma-eng You can change the pin code field to text. No specific guidelines on a PR. Just mention what you have worked on precisely in the description.