Home › Forums › Quform PHP › 'This field is required' doesn't go away when …
- This topic has 10 replies, 2 voices, and was last updated 6 years, 10 months ago by
bb3.
- AuthorPosts
- October 30, 2018 at 10:20 am #27532
bb3
Participant… the field is filled in.
should this message not disappear, when the field is corrected?
The validation works fine, displaying the error messages when a required field is omitted. But, when you correct the field, the error message stays on. How can it be turned off at that point?October 30, 2018 at 2:25 pm #27548Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 31, 2018 at 8:37 am #27555bb3
ParticipantHi Ally,
Thanks for that.
Must say, I don’t understand the design decision … it’s not the kind of form-filling behaviour I would be familiar with as a user.
If error messages still remain, when a field is ‘corrected’, it indicates to the user they are still doing something wrong, so it’s confusing.The new code doesn’t remove the error messages – it only allows the form to submit, which is not the outcome I was hoping for.
Is there a way to remove the messages as the fields are being corrected?
Regards
bbOctober 31, 2018 at 2:12 pm #27569Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 31, 2018 at 4:21 pm #27580bb3
ParticipantHi,
Thanks. Much appreciated.
Getting there now … it works … but not on the drop-down fields where you have to select an option.
Still somewhat of a crude solution – the error message disappears even without a proper email address format, although won’t submit the form until corrected. Still, it’s better than it was for sure. I’ll find a solution for that issue myself.
I would be ok with it for now if it also took care of the select drop-down lists.Cheers!
And thanks for you patience
bbNovember 4, 2018 at 5:31 pm #27599bb3
ParticipantAnother thing on the validation:
I read the advanced section and put this in process php$email = new Quform_Element('email', 'Email address'); $email->addFilter('trim'); $email->addValidator('required'); $email->addValidator('email', array( 'messages' => array('invalid' => 'The email address %s is invalid') ));
Quote from the documentation:
“If the value is not valid, the error messages generated by the Validator will be returned back to the user and the form will not be submitted.”
I can’t get anything returned to the user (when using an obviously incorrect), no matter what I do.
I am using my own form, but, in case it mattered, I even tried wrapping that email field in everything – quform element, quform spacer etc – everything that appears in the examples. Still no message? I’m flummoxed!November 5, 2018 at 11:23 am #27606Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 5, 2018 at 11:25 am #27607Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 5, 2018 at 12:37 pm #27611bb3
ParticipantHi Ally
Thanks for all of that.
Much appreciated again.The email field I have in the form is already as you suggest:
<input name="email" type="email" id="email" placeholder="your email address" />
I thought the email address validator file in the quform lib folder took care of validation the email address? Maybe another step is needed … ?I will send the files …
Thank you
BBNovember 8, 2018 at 2:13 pm #27659Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 8, 2018 at 9:54 pm #27666bb3
ParticipantVery helpful information here, many thanks once again. Loads of info to digest in the link as well.
So, modern browsers do email validation automatically, even if limited. Mine is a bit old so I’m still getting the quform-error message when trying your first example using the word ‘test’ above.Before getting the updated ‘scripts’ code, and to achieve consistency, I removed all validation from the process file, except for the email. I even gave that email field the advanced treatment as per instructions in the documentation.
Testing it didn’t produce any error message at all! Nothing! I still don’t know why, but after now adding back in all the other validation as I originally had it in the process file, everything is working again, email as well. So, the previous scenario can remain a mystery.
Thank you for the updated scripts code. The form is looking a lot more consistent now. Really appreciated.
Kind regards
bb - AuthorPosts
- You must be logged in to reply to this topic.