Forums

About field validation

spsh21 20 Jun, 2017
Hi!

I have two text fields in my form (f1 and f2) and I want to validate the second field to match the first one. I filled in the field "Matches" on validation tab of the second field (f2) with f1. Validation works normal, except if I fill in field f1 with some data and leave field f2 empty the validation doesn't work.

And another question. If validation fails the displayed error message is the text from field "Label" of f2.
How can I display my own error message?



Best regards,
Sergey
Max_admin 25 Jun, 2017
Hi Sergey,

You will need to use the "id" of the field 1

If you want your own error message then you will need to use the "Validation rules" box "for now", the next update should have a setting to set the error message.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
spsh21 26 Jun, 2017
Hi Max,

I used the "id" of the field 1 in the field "Matches" on validation tab of field 2. But when the second field is empty and the first one is filled with some data the validation doesn't work.

As for error message, I can't understand how to fill the "Validation rules" box in my case

Best regards,
Sergey
Max_admin 27 Jun, 2017
Hi Sergey,

Please make the 2nd field required.

You better wait for the update with the new message setting then.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
spsh21 27 Jun, 2017
Hi Max!

I can't make the 2nd field required, because it may be empty (if the first one is empty).
These two fields are password and it's confirmation. If user don't want to change password he leaves them empty.

As for error message, I will wait for the update.

Best regards,
Sergey
Max_admin 30 Jun, 2017
Hi Sergey,

You can set the first field to match the 2nd one too, that should solve the problem.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
spsh21 30 Jun, 2017
Hi Max!

I did this, but in my opinion it works incorrect for my goal. When user enters the first field (the second is empty yet), the error message is displayed on field 1 and when user goes to field 2 and enters correct matching data the error message of field 1 is still visible. When user returns to field 1 the error message disappears.

In my opinion the error message must be shown only on field 2 after user fills or doesn't fill the second field.

Best regards,
Sergey
Max_admin 30 Jun, 2017
Hi Sergey,

I agree, if you want this behavior then maybe it will be available in a future update, you will need to setup an event for the first field, so that when its empty it will disable the 2nd field validation, or enable it when its not empty.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
spsh21 30 Jun, 2017
Hi Max!

When the first field is empty all works fine and when the first field is filled all works fine too. The problem occurs when the second field is empty and the first one is filled, the validation in this case is not working.

Best regards,
Sergey
Max_admin 02 Jul, 2017
Hi Sergey,

It works here but the error message is shown on the first field, this happens when the first field is NOT empty but the 2nd one IS empty.

Is this the problem you are targeting ?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
spsh21 02 Jul, 2017
Hi Max!

Yes, this is my problem.

When the first field is NOT empty but the 2nd one IS empty. If in this case submit button is pressed the validation rule set on the second field doesn't work and submit event occurs.

Best regards,
Sergey
Max_admin 02 Jul, 2017
Hi Sergey,

The first field "match" rule has the "id" of the 2nd field, and the 2nd field "match" rule has the "id" of the first field, correct ?

This is how I have it and it works, if the first field is not empty but the 2nd is empty then an error message is shown and the form does not submit.

You can attach a test form backup here if you can not get it to work, but anyway the next update should have a better solution for this issue.

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
spsh21 03 Jul, 2017
Hi Max!

Here is my test form. Please, have a look at it. I've filled it exactly as you wrote above. Validation works, but incorrect, I think.
If you'll try to fill the 1st field and then move focus to the 2nd field you get the error message. That is the problem. The error message has to be shown at the 2nd field after user fills the 2nd field (not the first one).
I can't set "validation message" to "Errors list below form" because my form has many input fields and it is not easy-to-use for users.


Best regards,
Sergey
This topic is locked and no more replies can be posted.