I am now searching over 3 ours in this forum for a simple description of the following need: I have 4 fields in my form that are required to be filled. I would like to show a popup "Please enter required fields" when the user is pushing the submit button.
I am using Chronoforms 3.0 stable. It's really a creat tool :-)
I am using Chronoforms 3.0 stable. It's really a creat tool :-)
Hi harzenmoser,
I'm sure that it's possible, but I haven't seen it done. The validation JavaScript supports custom messages, and I guess that they could be in pop-ups. You'll need to work out the coding though.
Bob
I'm sure that it's possible, but I haven't seen it done. The validation JavaScript supports custom messages, and I guess that they could be in pop-ups. You'll need to work out the coding though.
Bob
Hi Bob
So i am a step nearer to the solution :-) Ich found a Code that compairs two fields (password validation) that works:
<?php
global $mainframe;
if(JRequest::getVar('text_3') != JRequest::getVar('text_4'))
return 'Sorry, your passwords do not match, try again!';
?>
So now instead of compairing the two fields i would like to check 4 fields if they are empty. I tried this:
<?php
global $mainframe;
if(JRequest::getVar('name') !== ''))
return 'Please fill in the required fields';
?>
But even more i shoud check 3 more fields :-)
Thanx for your help 🤣
So i am a step nearer to the solution :-) Ich found a Code that compairs two fields (password validation) that works:
<?php
global $mainframe;
if(JRequest::getVar('text_3') != JRequest::getVar('text_4'))
return 'Sorry, your passwords do not match, try again!';
?>
So now instead of compairing the two fields i would like to check 4 fields if they are empty. I tried this:
<?php
global $mainframe;
if(JRequest::getVar('name') !== ''))
return 'Please fill in the required fields';
?>
But even more i shoud check 3 more fields :-)
Thanx for your help 🤣
Hi harzenmoser,
Why don't you just use the built in validation? The only thing it doesn't do is show the message in a pop-up. It doesn't do the password match eitehr but I posted a fix for that a few days ago.
Bob
Why don't you just use the built in validation? The only thing it doesn't do is show the message in a pop-up. It doesn't do the password match eitehr but I posted a fix for that a few days ago.
Bob
Hello again
We did some tests and we recognized that a lot of user don't see the message that is shoen automatically just under the required field. In the form we used before there was shown a popup after pushing the send button ("Please fill in the required fields"). This seemed to be userfriendlier than the solution used in chronoforms. So finally it's a customer decision / wish.
hugo
We did some tests and we recognized that a lot of user don't see the message that is shoen automatically just under the required field. In the form we used before there was shown a popup after pushing the send button ("Please fill in the required fields"). This seemed to be userfriendlier than the solution used in chronoforms. So finally it's a customer decision / wish.
hugo
Hi harzenmoser,
So back to my earlier post - use the built in validation but customise the error message.
Bob
So back to my earlier post - use the built in validation but customise the error message.
Bob
So i used this code on the server side validation:
Thak your for your message. We will contact you as soon as possible.
I guess the !== '' in the code is wrong...
<?php
global $mainframe;
if(JRequest::getVar('name') !== ''))
return 'Please fill in the required fields';
?>
I got this error message (the form has been sent):Parse error: syntax error, unexpected T_RETURN in /home/www/web308/html/cms/components/com_chronocontact/chronocontact.php(190) : eval()'d code on line 4
Thak your for your message. We will contact you as soon as possible.
I guess the !== '' in the code is wrong...
Hi harzenmoser,
Yes the operator is wrong and there's an extra ). I think the code should be:
Bob
Yes the operator is wrong and there's an extra ). I think the code should be:
<?php
global $mainframe;
if ( JRequest::getVar('name') == '' ) return 'Please fill in the required fields';
?>
or you make it a bit shorter in this case<?php
global $mainframe;
if ( !JRequest::getVar('name') ) return 'Please fill in the required fields';
?>
Bob
Thank you Bob - it works 😀
So there's is a last question: How can i change the background colour of the table that contains the message? It's pink - at that doesn't match the template 8)
Hugo
So there's is a last question: How can i change the background colour of the table that contains the message? It's pink - at that doesn't match the template 8)
Hugo
Hi harzenmoser,
Just add a little css - I forget the class name that's applied - something like 'validation-advice'. Check the page source code to see exactly what it is.
Bob
Just add a little css - I forget the class name that's applied - something like 'validation-advice'. Check the page source code to see exactly what it is.
Bob
Hi Bob
As my last request is css related i made a new post:
http://www.chronoengine.com/forums.html?cont=posts&f=2&t=12089
As my last request is css related i made a new post:
http://www.chronoengine.com/forums.html?cont=posts&f=2&t=12089
This topic is locked and no more replies can be posted.