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
Resolve "Discount Amount" field is validated after the page load without any action from user in Create New Catalog Rule form issue23777 #23779
Conversation
Hi @edenduong. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
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.
Hi @edenduong thank you for your contribution.
We already have similar pull request for this issue.
Not sure that the author will continue work.
I just copy my comment from that PR here:
Adding default value is not actually the best solution. We don't need zero here. Otherwise, we need a user to pay attention to this field. Better find out why validation fires during page rendering instead of validating by hitting the save button?
I see you are a cool contributor and I would appreciate if you'll investigate and provide a better solution here.
Thanks.
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.
Please see my comment. Thanks
Hi @Stepa4man, thank you for the review.
|
@Stepa4man: Thank you for your feedback. I will find other solution :) I suggest the default value for the form because I see in the salerule, it fill the default 0. Thank you very much. :) |
@edenduong From the user experience adding a predefined value of the most important field in Rule form is not a pretty good solution. Sometimes merchant creates a lot of rules one by one manually and this routine could cause some unfilled form fields. Not everything that we have already done in Magento is the best solution:) |
e4e891f
to
76ac8d9
Compare
…out any action from user in Create New Catalog Rule form issue23777
76ac8d9
to
4954bd1
Compare
Hello @Stepa4man : I have just changed the source code.
try to log it: Because the "discount_amount" in the xml field has the default validation (required-entry) doesn't match with the default "Apply" field "Apply as percentage of original" - callback validation rule (required-entry, validate-number-range 0-100) => that field was validated after the page load. So we should add the "validate-number-range 0-100" to "discount_amount" default validation. It will match and no-validation anymore :) |
@magento give me test instance |
Hi @Stepa4man. Thank you for your request. I'm working on Magento instance for you |
Hi @Stepa4man, here is your new Magento instance. |
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.
Good job, @edenduong. Thanks for your effort!
Hi @Stepa4man, thank you for the review.
|
✔️ QA passed |
Hi @edenduong, thank you for your contribution! |
…age load without any action from user in Create New Catalog Rule form issue23777 #23779
Description (*)
When the page loading, I see the function in vendor/magento/module-ui/view/base/web/js/form/element/abstract.js
try to log it:
Because the "discount_amount" in the xml field has the default validate (required-entry) doesn't match with the default "Apply" field "Apply as percentage of original" (required-entry, validate-number-range 0-100) so that field was validated after the page load. So we should add the "validate-number-range 0-100" to "discount_amount" default validate. It will match and no-validation anymore :)
Fixed Issues (if relevant)
Manual testing scenarios (*)
Result:
Questions or comments
Contribution checklist (*)