Timeline for Client side validation - custom event handler not called when user enters the field and leaves it being empty
Current License: CC BY-SA 4.0
60 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:58 | history | edited | CommunityBot |
Commonmark migration
|
|
Jan 29, 2019 at 20:16 | comment | added | Zollie | @wanderlusted - Thank you also for your feedback! A bit later I still want to still check on adding the custom handler further. I wish you good time on the development of your project! | |
Jan 29, 2019 at 20:02 | vote | accept | wanderlusted | ||
Jan 29, 2019 at 20:01 | comment | added | wanderlusted | @Zollie, I truly appreciate the amount of time you put into this investigation. I agree that final conclusion is right, using the "required" attribute the standard Joomla validation kicks even in this special case and changes the field into red. Unfortunately this was not sufficient for me as I wanted to have a custom validation icon and message displayed by a custom event handler and the custom event handler is not called in this special case. Therefore I had to implement my client side validation from scratch not using the built in Joomla mechanism. Kudos for the results! | |
Jan 29, 2019 at 6:39 | history | edited | Zollie | CC BY-SA 4.0 |
added 19 characters in body
|
Jan 29, 2019 at 6:24 | comment | added | Zollie | @mickmackusa - Thank you, Mick for your feedback and +1 on this! I also learned new things from your regex class yesterday! ;) | |
Jan 29, 2019 at 6:17 | comment | added | mickmackusa | Love your diligence. Great post with animated image as proof of success. +1 | |
Jan 29, 2019 at 6:07 | history | edited | Zollie | CC BY-SA 4.0 |
added 53 characters in body; added 17 characters in body; deleted 8 characters in body
|
Jan 29, 2019 at 5:58 | history | edited | Zollie | CC BY-SA 4.0 |
added 1 character in body
|
Jan 29, 2019 at 5:53 | comment | added | Zollie | @wanderlusted - finally I checked the whole thing this morning and updated my answer with what I've found on this. The question is solved more or less. :) | |
Jan 29, 2019 at 5:51 | history | edited | Zollie | CC BY-SA 4.0 |
updated my answer with a test of Joomla field validation on blur and wrote the final words on this subject; added 13 characters in body
|
Jan 28, 2019 at 20:00 | history | edited | Zollie | CC BY-SA 4.0 |
deleted 1 character in body
|
Jan 28, 2019 at 18:24 | history | edited | Zollie | CC BY-SA 4.0 |
added 96 characters in body
|
Jan 28, 2019 at 18:12 | history | edited | Zollie | CC BY-SA 4.0 |
added link to validate.js Joomla
|
Jan 28, 2019 at 18:05 | history | edited | Zollie | CC BY-SA 4.0 |
added 34 characters in body
|
Jan 28, 2019 at 17:59 | comment | added | Zollie | @Lodder - as I see that the particular function that you linked to, only checks if the field is set to required. Email field checking happens at another line, but your link is really very helpful in understanding the subject. | |
Jan 28, 2019 at 17:55 | history | edited | Zollie | CC BY-SA 4.0 |
deleted 4 characters in body
|
Jan 28, 2019 at 17:49 | history | edited | Zollie | CC BY-SA 4.0 |
adding the analyses of validation of input fields in Joomla on Blur events
|
Jan 28, 2019 at 14:02 | comment | added | Zollie | @wanderlusted - I just now lost focus again :) by the fact that Lodder pointed to the Joomla field validation script which looks OK for me and now I am thinking where wanderlusted script is coming from and how it got in the subject then if Joomla has it’s own validation script which is totally different what is in the original question? I’m just getting lost here :) | |
Jan 28, 2019 at 12:46 | comment | added | Zollie | @wanderlust - yes, Lodder is right, in the meantime I got the focus and I realized that too. :) | |
Jan 28, 2019 at 12:37 | comment | added | Lodder | @wanderlusted - That might be the line you're looking for: github.com/joomla/joomla-cms/blob/staging/media/system/js/… | |
Jan 28, 2019 at 12:26 | comment | added | wanderlusted | @Lodder: i think your first comment points out the problem I´m really dealing with: "It must be something with Joomla's validation method that checks of the field is blank first " But I unfortunately I don`t know how to debug or fix this. | |
Jan 28, 2019 at 12:24 | comment | added | wanderlusted | @zollie:to reflect to your point in the above answer, yes the form contains the "form-validate" attribute. I added this to my original question. Once again the problem is that the custom event handler IS called when I leave the field after typing something, but does NOT run, when I type something, delete it and then leave the field. | |
Jan 28, 2019 at 6:55 | history | edited | Zollie | CC BY-SA 4.0 |
added 44 characters in body
|
Jan 28, 2019 at 5:57 | history | edited | Zollie | CC BY-SA 4.0 |
added 65 characters in body
|
Jan 28, 2019 at 5:22 | history | edited | Zollie | CC BY-SA 4.0 |
deleted my earlier answer and reformulated it
|
Jan 27, 2019 at 21:57 | history | edited | Zollie | CC BY-SA 4.0 |
added 39 characters in body
|
Jan 27, 2019 at 21:37 | history | edited | Zollie | CC BY-SA 4.0 |
added jQuery on blur on input field
|
Jan 27, 2019 at 20:40 | comment | added | Zollie | @Lodder - other than that, the blur event ignites differently on different html elements, like image, button, input field and so on, I had a luck to check these a bit more deeply earlier. :) | |
Jan 27, 2019 at 20:17 | comment | added | Zollie | @Lodder - checking whether the field is empty was missing from the script, that’s the point. But before the script was not given by the OP. | |
Jan 27, 2019 at 20:06 | comment | added | Lodder | @Zollie, the blue/focus events by default will always trigger, whether there's content in the field or not ;) It must be something with Joomla's validation method that checks of the field is blank first | |
Jan 27, 2019 at 19:35 | comment | added | Zollie | @wanderlusted - I understand now exactly what you trying to say and explain but please try my second (updated) and/or third version of the script, Please do not ignore them without trying them again. Then I'll check further on the event handler. | |
Jan 27, 2019 at 19:16 | comment | added | wanderlusted | thanks again for the comment, but I'm still not sure if I could clearly explain myself: the problem is that the event handler is not called if I enter something in the field and then delete it and then leave the field. So whatever else you suggest to add to the event handler it will not help as the method is not called in this scenario. | |
Jan 27, 2019 at 18:49 | history | edited | Zollie | CC BY-SA 4.0 |
only styling...
|
Jan 27, 2019 at 18:09 | comment | added | Zollie | @wanderlusted - and please give me some feedback how it goes. | |
Jan 27, 2019 at 18:07 | history | edited | Zollie | CC BY-SA 4.0 |
added 51 characters in body
|
Jan 27, 2019 at 17:38 | history | edited | Zollie | CC BY-SA 4.0 |
just styling...
|
Jan 27, 2019 at 17:05 | history | edited | Zollie | CC BY-SA 4.0 |
added 981 characters in body; added 47 characters in body
|
Jan 27, 2019 at 16:47 | history | edited | Zollie | CC BY-SA 4.0 |
added 24 characters in body
|
Jan 27, 2019 at 16:43 | comment | added | Zollie | @wanderlusted - I am sorry, I updated my last script since the 'if empty' checking has to be first, then the other regex checking of the field, so I had to change the sequence in the script. Now it looks OK. Please try this new version on your form | |
Jan 27, 2019 at 16:36 | history | edited | Zollie | CC BY-SA 4.0 |
added 4 characters in body
|
Jan 27, 2019 at 16:24 | history | edited | Zollie | CC BY-SA 4.0 |
added 176 characters in body
|
Jan 27, 2019 at 16:21 | comment | added | Zollie | @wanderlusted - I understand you. I re-wrote the script which is now on blur checks if the field is empty or not. Your script would never have done that since your script works with regex which cannot check empty fields this way as it is, since regex checks characters, thus on empty it does nothing in your script, thus not ignites anything if empty. | |
Jan 27, 2019 at 16:17 | history | edited | Zollie | CC BY-SA 4.0 |
added another version of the script which on blur() checks if the field is left empty
|
Jan 27, 2019 at 15:49 | comment | added | wanderlusted | thanks again for the suggestions! It seems that I did not describe my problem very clearly, so now I updated my post, please see the sentences marked with bold. My problem is NOT the case when the user never enters the field. | |
Jan 27, 2019 at 15:46 | history | edited | Zollie | CC BY-SA 4.0 |
added 37 characters in body
|
Jan 27, 2019 at 15:37 | history | edited | Zollie | CC BY-SA 4.0 |
added 54 characters in body
|
Jan 27, 2019 at 15:28 | history | edited | Zollie | CC BY-SA 4.0 |
define jQuery in the script; added 120 characters in body
|
Jan 27, 2019 at 15:24 | comment | added | Zollie | @wanderlusted - I updated my answer with the script in which I put empty field validation for you. This you should use at least at field validation. | |
Jan 27, 2019 at 15:22 | history | edited | Zollie | CC BY-SA 4.0 |
added the edited validation function to the script
|
Jan 27, 2019 at 14:48 | comment | added | Zollie | @wanderlusted - now I checked your function script and if it is ignited on blur, then it will never validate untouched empty field, as I describedi it in my answer. It ignites only if someone at least clicks into the field, but if someone just ignores the field it will never fire. You have to built in a short added function which ignites on submit button and checks if the fields are empy as I also wrote. If you need I’ll give you an example added to my answer. | |
Jan 27, 2019 at 14:40 | history | edited | Zollie | CC BY-SA 4.0 |
Empty field validation has to be independent from blur() function
|
Jan 27, 2019 at 14:37 | comment | added | Zollie | @wanderlusted - and I am sure if someone clicks into your field and then leave it empty, your blur event is working too on your page. It only does not ignite if someone never clicks in the field. That’s what I was writing about. An empy field checking script also has to be run independently from blur() function. Please understand this. | |
Jan 27, 2019 at 14:31 | comment | added | Zollie | @wanderlusted - edit your question and add the event handler script to it. I’d like to see what that is exactly. | |
Jan 27, 2019 at 14:29 | history | edited | Zollie | CC BY-SA 4.0 |
Second possible reason of the problem
|
Jan 27, 2019 at 14:27 | comment | added | wanderlusted | My more general problem is that I'd like to use this custom event hander to check any problems with the input, if it is correctly filled in, or empty, or anything else and then display a custom error message. Unfortunately I can't this now for the empty case as the handler is not called... | |
Jan 27, 2019 at 14:27 | comment | added | Zollie | @wanderlusted - since you did not copy here the function which should be ignited by blur, that was the only thing came to my mind. Until I do not see the script I cannot answer, only bet. | |
Jan 27, 2019 at 14:21 | history | edited | Zollie | CC BY-SA 4.0 |
added 76 characters in body
|
Jan 27, 2019 at 14:21 | comment | added | wanderlusted | Thanks for the quick response! However I'm not sure if this is completely true. If I click the field (my cursor blinks in the field) and leave it without typing anything or type something and then delete it before leaving the field, I would think that it gets the focus and looses it again when I click elsewhere. This is also how examples on blur work, e.g. this one: w3schools.com/jquery/… I don't see why this is different with a Joomla generated field. | |
Jan 27, 2019 at 14:15 | history | answered | Zollie | CC BY-SA 4.0 |