Sorry I should’ve clarified, i’ll just explain my goal, its regarding the “edit record” button.
So upon clicking it and that window pops up with all the fields on, due to how many fields I have on there some fields need to be scrolled down too and if the user doesn’t notice this and tries submitting before filling all the other fields… I see that it turns red and says “this field is required” but if that field is currently below where they are on the field list, the error message isn’t seen unless its scrolled too. If that makes sense… so I recently stumbled across your code and figured it would suit my use case pretty well, it’s exactly what I need I’m just struggling with implementing it!
There is always a way, yes, but It would be too much time for me to find a solution or to think of the best way to do this for something that is not really a big problem (and that respects UX best practice).
= > Remember that most of the softwares don’t give more than this type of error indications, so it should be way enough for your users.
The only thing I can tell you is that you might use a mutation observer (mutation observer tied to the red error message “this field is required”).
I mean if a user doesn’t know what they need to do in order to submit I think that’s a pretty big problem, especially since our target audience for this app and I imagine many other apps aren’t people who would be inclined to scroll to investigate further.
My main point is that a user can attempt to edit a record and no error message is displayed unless the user scrolls down to then see the field that is required. I appreciate that the fact it states a field is required is useful but the usefulness ends when that message can no longer be seen unless scrolled… i don’t know, that seems like a flaw to me. Otherwise the user is just stuck in an endless loop of trying to update it without any notification to say otherwise!
However, thank you for that suggestion about the mutation observer, I will look into it!
You can also add your request in Feature Request, the size of error messages (well here it’s more about the placement) is a commom request from many users (that’s why I created this alertbox feature).
hi @matthieu_chateau not sure, i am using exactly the same code as you on the form, and i am not getting any alert message. Can you please check from your end if the code still works?
<div id="alertbox1" class="alertbox">
<div class="alertbox-header">Success</div>
<div class="alertbox-message">Your form has been submitted successfully.</div>
<button class="alertbox-close" onclick="document.getElementById('alertbox1').style.display='none';">×</button>
</div>
<div id="alertbox2" class="alertbox">
<div class="alertbox-header">Error</div>
<div class="alertbox-message">Sorry, there was an error submitting your form.</div>
<button class="alertbox-close" onclick="document.getElementById('alertbox2').style.display='none';">×</button>
</div>
Hey! I saw your work on this and it was very helpful for adding my own error checks in one of my forms. I was wondering, do you know if it’s possible/how to show error codes below the specific field in the form that the user is filling out incorrectly, rather than just below the form as you did your example? I have a lot of fields for the user to fill out, so it would be much cleaner to produce those error messages below the field itself.
No, this would take too much time for me to do this; too hard to get all the selectors, how to make it work in terms of user experience etc. => way too much work.
Previously everything was supposed to be in the custom header, Not we need to add a custom code and then add to the custom code header to make this work. Great find @matthieu_chateau .