[openstreetmap/openstreetmap-website] Added indicator message preview is empty. (PR #4894)
Anton Khorev
notifications at github.com
Sun Jun 30 23:45:13 UTC 2024
@AntonKhorev commented on this pull request.
> + if (editor.val().length === 0) {
+ var messageTitleElement = document.getElementById("message_title");
+ if (messageTitleElement) {
+ messageTitleElement.removeAttribute("required");
+ }
+
+ var diaryEntryTitleElement = document.getElementById("diary_entry_title");
+ if (diaryEntryTitleElement) {
+ diaryEntryTitleElement.removeAttribute("required");
+ }
+
+ return;
+ }
+
I don't necessarily agree that triggering the validation is a good idea, but if you really want to do it, you can just call `reportValidity` on an input:
```suggestion
event.preventDefault();
if (!editor[0].reportValidity()) {
return;
}
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4894#pullrequestreview-2150220708
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4894/review/2150220708 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240630/8bd6bb12/attachment.htm>
More information about the rails-dev
mailing list