-
Notifications
You must be signed in to change notification settings - Fork 88
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
Invalid combination of prototype JS validation classes #103
Comments
Note: After reading through the comment thread for issue #101 I would like to also add an additional validation prototype validation class for the Namespace and Module Name. It would most likely be along the lines as follows: Validation.add('umc-validate-class-name', 'Please use only letters (a-z or A-Z) or numbers (0-9) in this field, first character should be an uppercase letter.', function(v) {
return Validation.get('IsEmpty').test(v) || /^[A-Z]+[a-zA-Z0-9]+$/.test(v)
}); With that said, it may indeed be more appropriate to add this JavaScript (along with the JS above) within my second recommendation of |
@dfelton First of all I want to thank you for all the wonderful PRs you've done for this extension. All my respect and gratitude for making this better. |
@dfelton This should be implemented in version 1.9.6.0. Thanks for the regex. |
The umc.xml file has
validate-alphanum validate-code
for the class names of the "Entity code singular" and "Entity code plural" fields (lines 168 and 177). Both these input fields are contained within the "Name settings" section of setting up a new entity. The combination of these two prototype validation classes does not allow for camel casing or usage of underscores.validate-alphanum
would allow us to utilize camelCasing whilevalidate-code
would allow for us to use underscores.I'm currently working on an update to the extension to add a custom validation class for use by UMC for these two fields. Prior to pushing the changes to my UMC's branch and creating a pull request I wanted to get your feedback on my approach to a solution here, regarding what to actually allow. I think one of the following two validation tests would be appropriate:
OR
The only difference is that the first would allow for underscores, while the second would not. I feel the urge to go with the second option, as it more conforms to Zend's Coding Standard since underscores are only permitted as a prefix to protected/private class properties. However, doing some research it seems as though Zend is in the minority here for disallowing underscores in variable names (according to this Stack Overflow post).
Since this is your module, I figure I'd just ask. Do you have a preference here? I understand you've made efforts to conform the extension to Zend's coding standards so I suspect that'd be your preference.
Putting some thought into if this would create backwards compatibility issues for the community, I don't think there would be. UMC already doesn't allow for underscores in these two fields as it is; therefore existing modules created by UMC would still be valid.
Lastly, where would you put this snippit of JavaScript? My first inclination is to just throw it into the end of
js/ultimate_modulecreator.js
. But I notice that the file is entirely related to the definition of the UMC JavaScript object, so it may be appropriate to have ajs/ultimate_modulecreator/prototype/validation.js
file to store this.The text was updated successfully, but these errors were encountered: