Validate the name field on paste
On the paste page form shown below, I need to restrict the input to prevent capital letters. We have something similar on our form for creating new pages, but this doesn't seem to be working when I include a selector for the name field on the paste form.
This is the form where I need to prevent capital letters:

This code prevents capital letters on new pages:
var pageNamePattern = /^[a-z0-9_\-,]+$/; // remove A-Z from this regex so that authors cannot use upper-cased characters
$(window).adaptTo("foundation-registry").register("foundation.validation.validator", {
selector: '[data-foundation-validation~="admin.pagename"]',
validate: function(el) {
var valid = pageNamePattern.test(el.value) || el.value === "";
if (!valid) {
return Granite.I18n.get("mycompany.validation.page_name_regex");
}
}
});
The field name on the paste form does not have a `data-foundation-validation` value, so I'm using the selector `#pastePageDialog input` for a test. When I try this, the validation does not stop me from entering capital letters.